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 ScrollContentY(int NewPosition)
 {
     if (!VScroll.Thumb.Visible)
     {
         return;
     }
     Scrollable.ScrollToY(NewPosition);
     VScroll.SyncToView();
 }
Beispiel #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();
 }
 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);
 }
Beispiel #5
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);
 }
Beispiel #6
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);
    }
Beispiel #7
0
        IEnumerator Start()
        {
            vScroll = VScroll.Create(scrollRect);
            vScroll.SetViewMargin(10f);
            vScroll.SetContentMargin(5, 0, 5, 0);
            for (var i = 0; i < 10; i++)
            {
                vScroll.AddContent(prefab1, new SampleVScrollContentInfo());
            }
            for (var i = 0; i < 10; i++)
            {
                vScroll.AddContent(prefab2, new SampleVScrollContentInfo());
            }
            for (var i = 0; i < 10; i++)
            {
                vScroll.AddContent(prefab1, new SampleVScrollContentInfo());
            }
            yield return(null);

            // 1frameまつ必要がある。
            // UIの値反映が恐らくUpdate後になるのが理由?
            // TODO: またなくてもいけるようにする
            vScroll.Apply();
        }
 protected void Scrollable_ContentSizeChanged(IShape ResizedShape, Point OldSize)
 {
     VScroll.SyncToView();
     HScroll.SyncToView();
     // RaiseNeedRedraw(this);
 }