Skip to content

Form1.cs | timer1_Tick

HackTheDev edited this page May 3, 2021 · 1 revision

This code is used to set the mouse position to the center of the screen. Optionaly, you can perform a mouse click too by uncommenting the line //DoMouseClick(); => DoMouseClick();.

This is a small workaround to kind of disable the Windows Key and also ALT + TAB combination.

            Point screenPos = System.Windows.Forms.Cursor.Position;
            Point leftTop = new System.Drawing.Point(Screen.PrimaryScreen.WorkingArea.Width / 2, Screen.PrimaryScreen.WorkingArea.Height / 2);
            Cursor.Position = leftTop;

            //DoMouseClick();