Exemple #1
0
 //Update the number margin when zoom in or zoom out
 private void OnTypingArea_SizeChanged(object sender, EventArgs e)
 {
     //Font fnt = new Font(FontFamily.GenericMonospace, typingArea.Font.Size);
     LineNumberTextBox.Font = typingArea.Font;
     AddLineNumbers();
     LineNumberTextBox.Refresh();
     LineNumberTextBox.Invalidate();
     //LineNumberTextBox.ZoomFactor = typingArea.ZoomFactor;
     //Font fnt = new Font(FontFamily.GenericMonospace, typingArea.Font.Size * LineNumberTextBox.ZoomFactor);
     //LineNumberTextBox.Font=fnt;
 }
Exemple #2
0
        private void OnTypingArea_VScroll(object sender, EventArgs e)
        {
            LineNumberTextBox.Text = "";
            //AddLineNumbers();
            AddLineNumbers();
            LineNumberTextBox.Refresh();
            DocumentMap.Refresh();

            //Method to synchronize scroll between Typing Area and Document Map
            //Reference: https://stackoverflow.com/questions/1827323/c-synchronize-scroll-position-of-two-richtextboxes
            int nPos = GetScrollPos(TypingArea.Handle, (int)ScrollBarType.SbVert);

            nPos <<= 16;
            uint wParam = (uint)ScrollBarCommands.SB_THUMBPOSITION | (uint)nPos;

            SendMessage(DocumentMap.Handle, (int)Message.WM_VSCROLL, new IntPtr(wParam), new IntPtr(0));
        }