I am making a C # WinForms application. For some reason, MouseMove and MouseClick events on the form do not fire. (I will probably feel like an idiot when I find out why.) This is a transparent form (the TransparencyKey is set to the background color) with a translucent animated gif in the Picture Box. I am doing a screensaver. Any suggestions?
EDIT: MainScreensaver.cs
Random randGen = new Random(); public MainScreensaver(Rectangle bounds) { InitializeComponent(); this.Bounds = Bounds; } private void timer1_Tick(object sender, EventArgs e) { Rectangle screen = Screen.PrimaryScreen.Bounds; Point position = new Point(randGen.Next(0,screen.Width-this.Width)+screen.Left,randGen.Next(0,screen.Height-this.Height)+screen.Top); this.Location = position; } private void MainScreensaver_Load(object sender, EventArgs e) { Cursor.Hide(); TopMost = true; } private Point mouseLocation; private void MainScreensaver_MouseMove(object sender, MouseEventArgs e) { if (!mouseLocation.IsEmpty) {
Excerpt from MainScreensaver.Designer.cs InitialiseComponent ()
this.MouseClick += new System.Windows.Forms.MouseEventHandler(this.MainScreensaver_MouseClick); this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.MainScreensaver_MouseMove);
source share