public override void LayoutCore()
        {
            int ScrollbarSize = Scrollbar.InitialSize;

            Scrollable.Bounds.Location = this.Bounds.Location;
            int ScrollbarsMargin = (this.ScrollbarsVisible ? ScrollbarSize : 0);

            Scrollable.Bounds.Size.X = this.Bounds.Size.X - ScrollbarsMargin;
            Scrollable.Bounds.Size.Y = this.Bounds.Size.Y - ScrollbarsMargin;
            Scrollable.LayoutCore();

            VScroll.Bounds.Location.Set(Scrollable.Bounds.Right, Scrollable.Bounds.Location.Y);
            VScroll.Bounds.Size.Set(ScrollbarSize, Scrollable.Bounds.Size.Y);
            VScroll.LayoutCore();

            HScroll.Bounds.Location.Set(Scrollable.Bounds.Location.X, Scrollable.Bounds.Bottom);
            HScroll.Bounds.Size.Set(Scrollable.Bounds.Size.X, ScrollbarSize);
            HScroll.LayoutCore();

            BottomRightCorner.Bounds.Location.Set(VScroll.Bounds.Location.X, HScroll.Bounds.Location.Y);
            BottomRightCorner.Bounds.Size.Set(VScroll.Bounds.Size.X, HScroll.Bounds.Size.Y);

            VScroll.SyncToView();
            HScroll.SyncToView();
        }
 public void ScrollContentX(int NewPosition)
 {
     if (!HScroll.Thumb.Visible)
     {
         return;
     }
     Scrollable.ScrollToX(NewPosition);
     HScroll.SyncToView();
 }
示例#3
0
 public void AdjustVisibleArea()
 {
     VScroll.SuspendLayout();
     HScroll.SuspendLayout();
     Label.SuspendLayout();
     AdjustVisibleArea(Cursor.Selection.X, Cursor.GetRealY(Cursor.Selection.Y));
     AdjustVisibleArea(Cursor.Location.X, Cursor.GetRealY(Cursor.Location.Y));
     UpdateLabel(Cursor.Location.Y + 1, Math.Min(Text.Lines[Cursor.Location.Y].Length, Cursor.Location.X) + 1);
     VScroll.ResumeLayout();
     VScroll.ResumeLayout();
     HScroll.ResumeLayout();
     Label.ResumeLayout();
 }
示例#4
0
        protected virtual void OnHScroll(ScrollEventArgs e)
        {
            //	repaint the moved tabs
            Invalidate();

            //	Raise the event
            HScroll?.Invoke(this, e);

            if (e.Type == ScrollEventType.EndScroll)
            {
                _oldValue = e.NewValue;
            }
        }
 public void ScrollContentXY(int x, int y)
 {
     if (VScroll.Thumb.Visible)
     {
         Scrollable.ScrollToY(y);
         VScroll.SyncToView();
     }
     if (HScroll.Thumb.Visible)
     {
         Scrollable.ScrollToX(x);
         HScroll.SyncToView();
     }
     // RaiseNeedRedraw(this);
 }
示例#6
0
        void Panel_MouseWheel(Control sender, MouseEventArgs args)
        {
            // scroll

            if (UseWheelForHScroll)
            {
                HScroll.Scroll(Gui.MouseScroll);
            }
            else
            {
                VScroll.Scroll(Gui.MouseScroll);
            }

            // consume the mouse event
            args.Cancel = true;
        }
示例#7
0
 protected override void WndProc(ref Message m)
 {
     if (m.Msg == WM_HSCROLL)
     {
         HScroll?.Invoke(this, new EventArgs());
     }
     //else if (m.Msg == WM_VSCROLL)
     //{
     //    VScroll?.Invoke(this, new EventArgs());
     //}
     // 同 20 一样的还有:15 4140 49892
     else if (m.Msg == 15) // 鼠标滚动,上下键 控制屏幕滚动
     {
         VScroll?.Invoke(this, new EventArgs());
     }
     base.WndProc(ref m);
 }
示例#8
0
    void PanelOnPaint(object obj, PaintEventArgs pea)
    {
        Graphics grfx  = pea.Graphics;
        Brush    brush = new SolidBrush(ForeColor);

        int iCount = SysInfoStrings.Count;

        string[] astrLabels = SysInfoStrings.Labels;
        string[] astrValues = SysInfoStrings.Values;

        for (int i = 0; i < iCount; i++)
        {
            grfx.DrawString(astrLabels[i], Font, brush, 0, cySpace * i);
            grfx.DrawString(astrValues[i], Font, brush, cxCol, cySpace * i);
        }

        // test Выводим данные свойств класса ScrollableControl, наследуемого экземпляром panel
        grfx.DrawString(HScroll.ToString(), Font, brush, 400, 100);
        grfx.DrawString(VScroll.ToString(), Font, brush, 426, 100);
        grfx.DrawString(AutoScrollPosition.ToString(), Font, brush, 400, 100 + cySpace);
    }
 protected void Scrollable_ContentSizeChanged(IShape ResizedShape, Point OldSize)
 {
     VScroll.SyncToView();
     HScroll.SyncToView();
     // RaiseNeedRedraw(this);
 }
示例#10
0
        public XmlNode GenerateXML()
        {
            // Create XML Node and Attributes
            XmlDocument d = new XmlDocument();
            XmlNode output = d.CreateNode("element", "InputText", null);
            XmlAttribute adValidate = d.CreateAttribute("ADValidate");
            XmlAttribute _default = d.CreateAttribute("Default");
            XmlAttribute forceCase = d.CreateAttribute("ForceCase");
            XmlAttribute hint = d.CreateAttribute("Hint");
            XmlAttribute hScroll = d.CreateAttribute("HScroll");
            XmlAttribute password = d.CreateAttribute("Password");
            XmlAttribute prompt = d.CreateAttribute("Prompt");
            XmlAttribute question = d.CreateAttribute("Question");
            XmlAttribute regEx = d.CreateAttribute("RegEx");
            XmlAttribute required = d.CreateAttribute("Required");
            XmlAttribute variable = d.CreateAttribute("Variable");
            XmlAttribute condition = d.CreateAttribute("Condition");

            // Set Attribute Values
            adValidate.Value = ADValidate;
            _default.Value = Default;
            forceCase.Value = ForceCase;
            hint.Value = Hint;
            hScroll.Value = HScroll.ToString();
            password.Value = Password.ToString();
            prompt.Value = Prompt;
            question.Value = Question;
            regEx.Value = RegEx;
            required.Value = Required.ToString();
            variable.Value = Variable;
            condition.Value = Condition;

            // Append Attributes
            if (!string.IsNullOrEmpty(ADValidate))
            {
                output.Attributes.Append(adValidate);
            }
            if (!string.IsNullOrEmpty(Default))
            {
                output.Attributes.Append(_default);
            }
            if (!string.IsNullOrEmpty(ForceCase))
            {
                output.Attributes.Append(forceCase);
            }
            if (!string.IsNullOrEmpty(Hint))
            {
                output.Attributes.Append(hint);
            }
            if (null != HScroll)
            {
                output.Attributes.Append(hScroll);
            }
            if (null != Password)
            {
                output.Attributes.Append(password);
            }
            if (!string.IsNullOrEmpty(Prompt))
            {
                output.Attributes.Append(prompt);
            }
            if (!string.IsNullOrEmpty(Question))
            {
                output.Attributes.Append(question);
            }
            if (!string.IsNullOrEmpty(RegEx))
            {
                output.Attributes.Append(regEx);
            }
            if (null != Required)
            {
                output.Attributes.Append(required);
            }
            if (!string.IsNullOrEmpty(Variable))
            {
                output.Attributes.Append(variable);
            }
            if (!string.IsNullOrEmpty(Condition))
            {
                output.Attributes.Append(condition);
            }

            return output;
        }