I have a multi monitor setup and I want to paint a vertical and horizontal line as the user moves their cursor. The lines I want to paint should span all monitors. I'm not entirely sure how to adjust my form to make this possible since when i make it full screen it only maximizes to one monitor.
Do i have to make a form per monitor and send signals to each one when the cursor moves for it to repaint the line?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace fitAllScreens
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            FullScreen();
        }
        public void FullScreen()
        {
            List<int> xBounds = new List<int>() {};
            List<int> yBounds = new List<int>() {};
            foreach (Screen screen in Screen.AllScreens)
            {
                var bounds = screen.Bounds;
                xBounds.Add(bounds.X);
                xBounds.Add(bounds.Right);
                yBounds.Add(bounds.Y);
                yBounds.Add(bounds.Bottom);
            }
            int minX = xBounds.Min();
            int maxX = xBounds.Max();
            int minY = yBounds.Min();
            int maxY = yBounds.Max();
            Console.WriteLine(minX + " - " + maxX + " - " + minY + " - " + maxY);
        }
        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);
            Invalidate();
        }
        protected override void OnPaint(PaintEventArgs e)
        {
            var graphics = e.Graphics;
            base.OnPaint(e);
            // Draw ruler guides
            Console.WriteLine(Cursor.Position);
            var pos = this.PointToClient(Cursor.Position);
            using (var pen = new Pen(Color.Red))
            {
                pen.DashStyle = DashStyle.Dot;
                var screenBounds = Screen.PrimaryScreen.Bounds;
                graphics.DrawLine(pen, pos.X, screenBounds.Y, pos.X, screenBounds.Height);
                graphics.DrawLine(pen, screenBounds.X, pos.Y, screenBounds.Width, pos.Y);
            }
        }
    }
}
