Beispiel #1
0
 private void tbarBrightness_ValueChanged(object sender, EventArgs e)
 {
     WindowsSettingsBrightnessController.SetBrightness(tbarBrightness.Value);
     lblBrightness.Text = tbarBrightness.Value.ToString();
     timer.Stop();
     timer.Start();
 }
Beispiel #2
0
        protected override void WndProc(ref Message m)
        {
            base.WndProc(ref m);

            if (m.Msg == 0x0312)
            {
                /* Note that the three lines below are not needed if you only want to register one hotkey.
                 * The below lines are useful in case you want to register multiple keys, which you can use a switch with the id as argument, or if you want to know which key/modifier was pressed for some particular reason. */

                Keys        key      = (Keys)(((int)m.LParam >> 16) & 0xFFFF);      // The key of the hotkey that was pressed.
                KeyModifier modifier = (KeyModifier)((int)m.LParam & 0xFFFF);       // The modifier of the hotkey that was pressed.
                int         id       = m.WParam.ToInt32();                          // The id of the hotkey that was pressed.
                byte        brightness;
                //label1.Text += "Hotkey has been pressed!\n";
                if (key == increaseBrightnessKey)
                {
                    brightness = WindowsSettingsBrightnessController.SetBrightness(increase: true);
                    ShowForm(brightness);
                }
                else if (key == decreaseBrightnessKey)
                {
                    brightness = WindowsSettingsBrightnessController.SetBrightness(increase: false);
                    ShowForm(brightness);
                }
            }
        }
Beispiel #3
0
        private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            byte b = WindowsSettingsBrightnessController.GetBrightness();

            ShowForm(b);
        }