private RECT GetThumbRect()
        {
            RECT rct = new RECT();

            if (trackBar1.IsHandleCreated)
            {
                const int WM_USER          = 0x0400;
                const int TBM_GETTHUMBRECT = (WM_USER + 25);

                PInvoke.SendMessage(trackBar1.Handle, TBM_GETTHUMBRECT, IntPtr.Zero, ref rct);
            }
            return(rct);
        }
示例#2
0
 private void richTextBox1_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Modifiers == Keys.Control)
     {
         if (e.KeyCode == Keys.Add)
         {
             Font selectionFont = this.richTextBox1.SelectionFont;
             if (selectionFont == null)
             {
                 selectionFont = this.Font;
             }
             Font item = new Font(this.Font.FontFamily, selectionFont.Size + 0.75f);
             this.richTextBox1.SelectionFont = item;
             this.fontList.Add(item);
         }
         else if (e.KeyCode == Keys.Subtract)
         {
             Font font = this.richTextBox1.SelectionFont;
             if (font == null)
             {
                 font = this.Font;
             }
             if (font.Size > 6f)
             {
                 Font font4 = new Font(this.Font.FontFamily, font.Size - 0.75f);
                 this.richTextBox1.SelectionFont = font4;
                 this.fontList.Add(font4);
             }
         }
         else if (e.KeyCode == Keys.F)
         {
             if (this.richTextBox1.CanUndo)
             {
                 this.FixCurrent();
             }
             IntPtr hWnd = PInvoke.SendMessage(this.listView1.Handle, 0x104e, IntPtr.Zero, IntPtr.Zero);
             if (hWnd != IntPtr.Zero)
             {
                 PInvoke.SetWindowPos(hWnd, new IntPtr(-1), 0, 0, 0, 0, 0x13);
             }
             this.CreateMemoList();
             this.richTextBox1.Visible = false;
             this.Refresh();
             this.textBox1.Focus();
         }
     }
 }