Example #1
0
        protected void Keyboard_MouseMove(object sender, MouseEventArgs e)
        {
            Point mousePos = e.Location;

            if (KeysManager.IsKey(mousePos))
            {
                ToolTip      tt  = new ToolTip();
                IWin32Window win = this;
                tt.Show("String", (PictureBox)sender, mousePos);
            }
        }
Example #2
0
        protected void Keyboard_Paint(object sender, PaintEventArgs e)
        {
            PictureBox o = (PictureBox)sender;

            foreach (var key in PCStats.keyboard.keys)
            {
                Rectangle r = KeysManager.GetRectangle(key.linkedKeys);
                if (new Rectangle(0, 0, o.Width, o.Height).Contains(r.X, r.Y))
                {
                    e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb((int)(key.timesPressed * 225 / maxKeyPress), Color.Red)), r);
                }
            }
        }
Example #3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            bool existsKey = StartupManager.ExistsStartupKey(Program.appName),
                 isAdmin   = StartupManager.IsUserAdministrator();

            if (!StartupManager.CheckIfRunningUnderVsHost())
            {
                if (!existsKey)
                {
                    if (isAdmin)
                    {
                        StartupManager.AddApplicationToStartup(Program.appName);
                    }
                    else
                    {
                        StartupManager.RunAsAdmin();
                    }
                }
            }
            else
            {
                Console.WriteLine("Cannot run as an admin in vshost environment!");
            }

            m_GlobalHook = Hook.GlobalEvents();

            m_GlobalHook.MouseMoveExt += ExtMouseMoved;
            m_GlobalHook.KeyDown      += ExtKeyPress;

            /*foreach (var screen in Screen.AllScreens)
             * {
             *  // For each screen, add the screen properties to a list box.
             *  //listBox1.Items.Add("Device Name: " + screen.DeviceName);
             *  //listBox1.Items.Add("Bounds: " + screen.Bounds.ToString());
             *  //listBox1.Items.Add("Type: " + screen.GetType().ToString());
             *  //listBox1.Items.Add("Working Area: " + screen.WorkingArea.ToString());
             *  //listBox1.Items.Add("Primary Screen: " + screen.Primary.ToString());
             *  Console.WriteLine("Name: {0}", screen.DeviceName);
             *  Console.WriteLine("Bounds: {0}", screen.Bounds.ToString());
             *  Console.WriteLine("Working area: {0}", screen.WorkingArea.ToString());
             * }
             *
             * Console.WriteLine("({0}, {1})", ScreenSize.Width, ScreenSize.Height);
             * mouse = new int[ScreenSize.Width, ScreenSize.Height];*/

            DEVMODE vDevMode = new DEVMODE();
            int     i        = 0;

            /*while (EnumDisplaySettings(null, i, ref vDevMode))
             * {
             *  Console.WriteLine("Width:{0} Height:{1} Color:{2} Frequency:{3}",
             *                          vDevMode.dmPelsWidth,
             *                          vDevMode.dmPelsHeight,
             *                          1 << vDevMode.dmBitsPerPel, vDevMode.dmDisplayFrequency
             *                      );
             ++i;
             * }*/

            Timer1.Tick    += Timer1_Tick;
            Timer1.Interval = timerInterval;
            Timer1.Start();

            dpi = GetSystemDpi();

            //Console.WriteLine("Screen phys size: " + new Point(SystemInformation.VirtualScreen.Width, SystemInformation.VirtualScreen.Height));
            Console.WriteLine("Screen phys size: " + GetScreenPhysicalSize());
            Console.WriteLine("DPI: " + dpi);
            Console.WriteLine("Mouse Speed: " + GetMouseSpeed());

            KeysManager.GetPositions();

            counting = true;
        }
Example #4
0
 private void FormKey_Paint(object sender, PaintEventArgs e)
 {
     e.Graphics.DrawImage(Image.FromFile(Path.Combine(appPath, "keyboardPic.png")), new Rectangle(0, 0, 950, 268));
     foreach (var key in PCStats.keyboard.keys)
     {
         e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb((int)(key.timesPressed / maxKeyPress * 240), Color.Red)), KeysManager.GetRectangle(key.linkedKeys));
     }
 }