int updateInterval = 1000; // Milliseconds between each refresh of trails public FormTrackOverlay(MouseTracker tracker, Screen screen) { bounds = screen; mouse = tracker; mouse.MouseMoved += MouseMoved; bitmap = new Bitmap(screen.Bounds.Width, screen.Bounds.Height, PixelFormat.Format1bppIndexed); ColorPalette palette = bitmap.Palette; palette.Entries[0] = Color.White; palette.Entries[1] = trackColor; bitmap.Palette = palette; BackgroundImage = bitmap; dirtyrows = new ConcurrentBag <int>(); for (int y = 0; y < screen.Bounds.Height; y++) { dirtyrows.Add(y); } UpdateImage(); this.Location = screen.Bounds.Location; this.Size = screen.Bounds.Size; InitializeComponent(); tmrRedraw.Interval = updateInterval; if (screen.Primary) { SetupComponents(); } }
static void Main() { MouseTracker m = new MouseTracker(); m.Start(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); foreach (Screen s in Screen.AllScreens) { new FormTrackOverlay(m, s).Show(); } Application.Run(); m.Stop(); }