コード例 #1
0
ファイル: FormRect.cs プロジェクト: mlzboy/ScreenRecoder
 private void FormRect_EnabledChanged(object sender, EventArgs e)
 {
     if (!Enabled)
     {
         TopMost = false;
         WindowUtils.Bottom(Handle);
         label1.BackColor      = Color.Gray;
         label2.BackColor      = Color.Gray;
         label3.BackColor      = Color.Gray;
         label4.BackColor      = Color.Gray;
         pictureBox1.BackColor = Color.Gray;
         BaseColor             = Color.Gray;
         Invalidate();
     }
     else
     {
         TopMost = true;
         WindowUtils.Top(Handle);
         label1.BackColor      = Color.Red;
         label2.BackColor      = Color.Red;
         label3.BackColor      = Color.Red;
         label4.BackColor      = Color.Red;
         pictureBox1.BackColor = Color.Red;
         BaseColor             = Color.Red;
         Invalidate();
     }
 }
コード例 #2
0
        protected override void WndProc(ref Message m)
        {
            if (m.Msg == API.WM_HOTKEY)
            {
                //热键
                int id = m.WParam.ToInt32();
                switch (id)
                {
                case 0x8886:
                    btn_record_BtnClick(this, EventArgs.Empty);
                    break;

                case 0x8887:
                    btn_pause_BtnClick(this, EventArgs.Empty);
                    break;

                case 0x8888:
                    btn_stop_BtnClick(this, EventArgs.Empty);
                    break;

                case 0x8889:
                    //显示窗口热键
                    if (Settings.show_mini_recing && Settings.fullscreen && Recorder.State == Recorder.Record_State.RECORDING)
                    {
                        if (WindowUtils.IsTop(formRecMini.Handle))
                        {
                            WindowUtils.Bottom(formRecMini.Handle);
                        }
                        else
                        {
                            WindowUtils.SetForeground(formRecMini.Handle);
                        }
                    }
                    else
                    {
                        if (WindowUtils.IsVisible(Handle))
                        {
                            WindowUtils.Hide(Handle);
                        }
                        else
                        {
                            WindowUtils.Show(Handle);
                            WindowUtils.SetForeground(Handle);
                        }
                    }
                    break;

                case 0x8890:
                    btn_screen_shotcut_BtnClick(this, EventArgs.Empty);
                    break;
                }
            }
            else if (m.Msg == API.WM_DISPLAYCHANGE)
            {
                //屏幕大小更改
                UpdateScreenSize();
            }
            base.WndProc(ref m);
        }