Exemplo n.º 1
0
        public void PaintToEx(HCCanvas ACanvas)
        {
            RECT vRect = new RECT();

            ACanvas.Brush.Color = TitleBackColor;
            ACanvas.FillRect(HC.Bounds(0, 0, Width, Height));

            if (FOrientation == Orientation.oriHorizontal)  // 水平滚动条
            {
                // 左按钮
                ACanvas.Pen.Color = Color.White;
                vRect.Left        = FLeftBtnRect.Left + ((FLeftBtnRect.Right - FLeftBtnRect.Left) - 4) / 2 + 4;
                vRect.Top         = FLeftBtnRect.Top + ((FLeftBtnRect.Bottom - FLeftBtnRect.Top) - 7) / 2;
                ACanvas.DrawLine(vRect.Left, vRect.Top, vRect.Left, vRect.Top + 7);
                ACanvas.DrawLine(vRect.Left - 1, vRect.Top + 1, vRect.Left - 1, vRect.Top + 6);
                ACanvas.DrawLine(vRect.Left - 2, vRect.Top + 2, vRect.Left - 2, vRect.Top + 5);
                ACanvas.DrawLine(vRect.Left - 3, vRect.Top + 3, vRect.Left - 3, vRect.Top + 4);
                // 右按钮
                vRect.Left = FRightBtnRect.Left + ((FRightBtnRect.Right - FRightBtnRect.Left) - 4) / 2;
                vRect.Top  = FRightBtnRect.Top + ((FRightBtnRect.Bottom - FRightBtnRect.Top) - 7) / 2;
                ACanvas.DrawLine(vRect.Left, vRect.Top, vRect.Left, vRect.Top + 7);
                ACanvas.DrawLine(vRect.Left + 1, vRect.Top + 1, vRect.Left + 1, vRect.Top + 6);
                ACanvas.DrawLine(vRect.Left + 2, vRect.Top + 2, vRect.Left + 2, vRect.Top + 5);
                ACanvas.DrawLine(vRect.Left + 3, vRect.Top + 3, vRect.Left + 3, vRect.Top + 4);
                // 水平滑块
                vRect = FThumRect;
                HC.InflateRect(ref vRect, 0, -1);
                DoDrawThumBefor(ACanvas, vRect);
                ACanvas.Brush.Color = ThumBackColor;
                ACanvas.Pen.Color   = LineColor;
                ACanvas.Rectangle(vRect);
                // 滑块上的修饰
                vRect.Left = vRect.Left + (vRect.Right - vRect.Left) / 2;
                ACanvas.DrawLine(vRect.Left, 5, vRect.Left, Height - 5);
                ACanvas.DrawLine(vRect.Left + 3, 5, vRect.Left + 3, Height - 5);
                ACanvas.DrawLine(vRect.Left - 3, 5, vRect.Left - 3, Height - 5);
            }
            else  // 垂直滚动条
            {
                // 上按钮
                ACanvas.Pen.Color = Color.White;
                vRect.Left        = FLeftBtnRect.Left + ((FLeftBtnRect.Right - FLeftBtnRect.Left) - 7) / 2;
                vRect.Top         = FLeftBtnRect.Top + ((FLeftBtnRect.Bottom - FLeftBtnRect.Top) - 4) / 2 + 4;

                ACanvas.DrawLine(6, 12, 13, 12);
                ACanvas.DrawLine(vRect.Left, vRect.Top, vRect.Left + 7, vRect.Top);
                ACanvas.DrawLine(vRect.Left + 1, vRect.Top - 1, vRect.Left + 6, vRect.Top - 1);
                ACanvas.DrawLine(vRect.Left + 2, vRect.Top - 2, vRect.Left + 5, vRect.Top - 2);
                ACanvas.DrawLine(vRect.Left + 3, vRect.Top - 3, vRect.Left + 4, vRect.Top - 3);
                // 下按钮
                vRect.Left = FRightBtnRect.Left + ((FRightBtnRect.Right - FRightBtnRect.Left) - 7) / 2;
                vRect.Top  = FRightBtnRect.Top + ((FRightBtnRect.Bottom - FRightBtnRect.Top) - 4) / 2;
                ACanvas.DrawLine(vRect.Left, vRect.Top, vRect.Left + 7, vRect.Top);
                ACanvas.DrawLine(vRect.Left + 1, vRect.Top + 1, vRect.Left + 6, vRect.Top + 1);
                ACanvas.DrawLine(vRect.Left + 2, vRect.Top + 2, vRect.Left + 5, vRect.Top + 2);
                ACanvas.DrawLine(vRect.Left + 3, vRect.Top + 3, vRect.Left + 4, vRect.Top + 3);
                // 滑块
                vRect = FThumRect;
                HC.InflateRect(ref vRect, -1, 0);
                DoDrawThumBefor(ACanvas, vRect);
                ACanvas.Brush.Color = ThumBackColor;
                ACanvas.Pen.Color   = LineColor;
                ACanvas.Rectangle(vRect);
                // 滑块上的修饰
                vRect.Top = vRect.Top + (vRect.Bottom - vRect.Top) / 2;
                ACanvas.DrawLine(5, vRect.Top, Width - 5, vRect.Top);
                ACanvas.DrawLine(5, vRect.Top - 3, Width - 5, vRect.Top - 3);
                ACanvas.DrawLine(5, vRect.Top + 3, Width - 5, vRect.Top + 3);
            }
        }