예제 #1
0
        protected override void OnLayout(LayoutEventArgs levent)
        {
            base.OnLayout(levent);

            int bordersize = (!BorderColor.IsFullyTransparent()) ? 3 : 0;

            int textboxclienth = ClientRectangle.Height - bordersize * 2;       // border is within Client area
            int linesinbox     = EstimateLinesInBox(textboxclienth);

            int firstVisibleLine = unchecked ((int)(long)TextBox.SendMessage(EM.GETFIRSTVISIBLELINE, IntPtr.Zero, IntPtr.Zero));

            ScrollBar.SetValueMaximumLargeChange(firstVisibleLine, LineCount - 1, linesinbox);

            visibleonlayout = ScrollBar.IsScrollBarOn || DesignMode || !HideScrollBar;  // Hide must be on, or in design mode, or scroll bar is on due to values

            TextBox.Location = new Point(bordersize, bordersize);
            TextBox.Size     = new Size(ClientRectangle.Width - (visibleonlayout ? ScrollBarWidth : 0) - bordersize * 2, textboxclienth);

            //System.Diagnostics.Debug.WriteLine(this.Name + " text box size " + textboxclienth + " Lines " + linesinbox );

            ScrollBar.Location = new Point(ClientRectangle.Width - ScrollBarWidth - bordersize, bordersize);
            ScrollBar.Size     = new Size(ScrollBarWidth, textboxclienth);

            //System.Diagnostics.Debug.WriteLine("layout Scroll State Lines: " + LineCount + " FVL: " + firstVisibleLine + " textlines " + textboxlinesestimate);
        }
예제 #2
0
        private void UpdateScrollBar()            // from the richtext, vscroll occurred, set the scroll bar
        {
            int firstVisibleLine = unchecked ((int)(long)TextBox.SendMessage(EM.GETFIRSTVISIBLELINE, IntPtr.Zero, IntPtr.Zero));

            ScrollBar.SetValueMaximumLargeChange(firstVisibleLine, LineCount - 1, visiblelines);
            if (ScrollBar.IsScrollBarOn != scrollbarvisibleonlayout)     // need to relayout if scroll bars pop on
            {
                PerformLayout();
            }
        }
예제 #3
0
        private void UpdateScrollBar()            // from the richtext, vscroll occurred, set the scroll bar
        {
            int firstVisibleLine;

            if (Environment.OSVersion.Platform != PlatformID.Win32NT)
            {
                int firstVisibleChar = TextBox.GetCharIndexFromPosition(new Point(0, 0));
                firstVisibleLine = TextBox.GetLineFromCharIndex(firstVisibleChar);
                //System.Diagnostics.Debug.WriteLine("USB first VL:" + firstVisibleLine + " lines " + LineCount + " " + visiblelines );
            }
            else
            {
                firstVisibleLine = unchecked ((int)(long)TextBox.SendMessage(EM.GETFIRSTVISIBLELINE, IntPtr.Zero, IntPtr.Zero));
            }

            ScrollBar.SetValueMaximumLargeChange(firstVisibleLine, LineCount - 1, visiblelines);
            if (ScrollBar.IsScrollBarOn != scrollbarvisibleonlayout)     // need to relayout if scroll bars pop on
            {
                PerformLayout();
            }
        }