protected override void DoPaint(HCStyle aStyle, RECT aDrawRect, int aDataDrawTop, int aDataDrawBottom,
                                        int aDataScreenTop, int aDataScreenBottom, HCCanvas aCanvas, PaintInfo aPaintInfo)
        {
            base.DoPaint(aStyle, aDrawRect, aDataDrawTop, aDataDrawBottom, aDataScreenTop,
                         aDataScreenBottom, aCanvas, aPaintInfo);

            if (this.IsSelectComplate && (!aPaintInfo.Print))
            {
                aCanvas.Brush.Color = aStyle.SelColor;
                aCanvas.FillRect(aDrawRect);
            }

            aStyle.TextStyles[TextStyleNo].ApplyStyle(aCanvas, aPaintInfo.ScaleY / aPaintInfo.Zoom);

            if (!this.AutoSize)
            {
                aCanvas.TextRect(aDrawRect, aDrawRect.Left + FMargin, aDrawRect.Top + FMargin, FText);
            }
            else
            {
                aCanvas.TextOut(aDrawRect.Left + FMargin, aDrawRect.Top + FMargin, FText);
            }

            if (FMouseIn && (!aPaintInfo.Print))
            {
                aCanvas.Pen.Color = Color.Blue;
            }
            else  // 鼠标不在其中或打印
            {
                aCanvas.Pen.Color = Color.Black;
            }

            aCanvas.Pen.Width = FBorderWidth;

            if (FBorderSides.Contains((byte)BorderSide.cbsLeft))
            {
                aCanvas.MoveTo(aDrawRect.Left, aDrawRect.Top);
                aCanvas.LineTo(aDrawRect.Left, aDrawRect.Bottom);
            }

            if (FBorderSides.Contains((byte)BorderSide.cbsTop))
            {
                aCanvas.MoveTo(aDrawRect.Left, aDrawRect.Top);
                aCanvas.LineTo(aDrawRect.Right, aDrawRect.Top);
            }

            if (FBorderSides.Contains((byte)BorderSide.cbsRight))
            {
                aCanvas.MoveTo(aDrawRect.Right, aDrawRect.Top);
                aCanvas.LineTo(aDrawRect.Right, aDrawRect.Bottom);
            }

            if (FBorderSides.Contains((byte)BorderSide.cbsBottom))
            {
                aCanvas.MoveTo(aDrawRect.Left, aDrawRect.Bottom);
                aCanvas.LineTo(aDrawRect.Right, aDrawRect.Bottom);
            }
        }
Beispiel #2
0
        public void UpdateView(RECT aRect)
        {
            if (!FVisible)
            {
                return;
            }

            FGraphicCanvas.Brush.Color = HC.clBtnFace;
            FGraphicCanvas.FillRect(HC.Bounds(0, 0, FGraphic.Width, FGraphic.Height));
            FGraphicCanvas.Pen.Color = Color.FromArgb(240, 240, 240);
            FGraphicCanvas.MoveTo(0, 0);
            FGraphicCanvas.LineTo(0, FGraphic.Height - 2);
            FGraphicCanvas.LineTo(FGraphic.Width - 2, FGraphic.Height - 2);
            FGraphicCanvas.LineTo(FGraphic.Width - 2, 0);
            FGraphicCanvas.LineTo(0, 0);

            FGraphicCanvas.Pen.Color = Color.FromArgb(0x66, 0x66, 0x66);
            FGraphicCanvas.MoveTo(1, FGraphic.Height - 1);
            FGraphicCanvas.LineTo(FGraphic.Width - 1, FGraphic.Height - 1);
            FGraphicCanvas.LineTo(FGraphic.Width - 1, 1);

            int vLeft = FPadding;

            for (int i = 0; i < FControls.Count; i++)
            {
                if (FControls[i] is HCCustomToolButton)
                {
                    if (i == FActiveIndex)
                    {
                        FGraphicCanvas.Brush.Color = Color.FromArgb(51, 153, 255);
                        FGraphicCanvas.FillRect(HC.Bounds(vLeft, 1, FControls[i].Width, FGraphic.Height - 3));
                    }
                    else
                    if (i == FHotIndex)
                    {
                        FGraphicCanvas.Brush.Color = Color.FromArgb(0, 102, 204);
                        FGraphicCanvas.FillRect(HC.Bounds(vLeft, 1, FControls[i].Width, FGraphic.Height - 3));
                    }

                    if (FOnControlPaint != null)
                    {
                        FOnControlPaint(FControls[i], vLeft, 0, FGraphicCanvas);
                    }
                    else
                    {
                        FControls[i].PaintTo(vLeft, 0, FGraphicCanvas);
                    }
                }

                vLeft = vLeft + FControls[i].Width + FPadding;
            }

            if (FOnUpdateView != null)
            {
                FOnUpdateView(aRect, FGraphicCanvas);
            }
        }
Beispiel #3
0
        protected override void DoDrawItemPaintContent(HCCustomData aData, int aItemNo, int aDrawItemNo,
                                                       RECT aDrawRect, RECT aClearRect, string aDrawText,
                                                       int aDataDrawLeft, int aDataDrawRight, int aDataDrawBottom, int aDataScreenTop, int aDataScreenBottom,
                                                       HCCanvas aCanvas, PaintInfo aPaintInfo)
        {
            if ((FOnDrawItemAnnotate != null) && DrawItemOfAnnotate(aDrawItemNo, aCanvas, aClearRect))  // 当前DrawItem是某批注中的一部分
            {
                HCDrawItemAnnotate vDrawAnnotate;
                bool vActive;
                for (int i = 0; i <= FDrawItemAnnotates.Count - 1; i++)
                {
                    vDrawAnnotate = FDrawItemAnnotates[i];

                    if (!aPaintInfo.Print)
                    {
                        vActive = vDrawAnnotate.DataAnnotate.Equals(FHotAnnotate) ||
                                  vDrawAnnotate.DataAnnotate.Equals(FActiveAnnotate);

                        if (vActive)
                        {
                            aCanvas.Brush.Color = HC.AnnotateBKActiveColor;
                        }
                        else
                        {
                            aCanvas.Brush.Color = HC.AnnotateBKColor;
                        }
                    }

                    if (vDrawAnnotate.First())  // 是批注头
                    {
                        aCanvas.Pen.Color = Color.Red;
                        aCanvas.MoveTo(vDrawAnnotate.DrawRect.Left + 2, vDrawAnnotate.DrawRect.Top - 2);
                        aCanvas.LineTo(vDrawAnnotate.DrawRect.Left, vDrawAnnotate.DrawRect.Top);
                        aCanvas.LineTo(vDrawAnnotate.DrawRect.Left, vDrawAnnotate.DrawRect.Bottom);
                        aCanvas.LineTo(vDrawAnnotate.DrawRect.Left + 2, vDrawAnnotate.DrawRect.Bottom + 2);
                    }

                    if (vDrawAnnotate.Last())  // 是批注尾
                    {
                        aCanvas.Pen.Color = Color.Red;
                        aCanvas.MoveTo(vDrawAnnotate.DrawRect.Right - 2, vDrawAnnotate.DrawRect.Top - 2);
                        aCanvas.LineTo(vDrawAnnotate.DrawRect.Right, vDrawAnnotate.DrawRect.Top);
                        aCanvas.LineTo(vDrawAnnotate.DrawRect.Right, vDrawAnnotate.DrawRect.Bottom);
                        aCanvas.LineTo(vDrawAnnotate.DrawRect.Right - 2, vDrawAnnotate.DrawRect.Bottom + 2);

                        FOnDrawItemAnnotate(aData, aDrawItemNo, vDrawAnnotate.DrawRect, vDrawAnnotate.DataAnnotate);
                    }
                }
            }

            base.DoDrawItemPaintContent(aData, aItemNo, aDrawItemNo, aDrawRect, aClearRect, aDrawText,
                                        aDataDrawLeft, aDataDrawRight, aDataDrawBottom, aDataScreenTop, aDataScreenBottom, aCanvas, aPaintInfo);
        }
        protected override void DoPaint(HCStyle AStyle, RECT ADrawRect,
                                        int ADataDrawTop, int ADataDrawBottom, int ADataScreenTop,
                                        int ADataScreenBottom, HCCanvas ACanvas, PaintInfo APaintInfo)
        {
            ACanvas.Pen.BeginUpdate();
            try
            {
                ACanvas.Pen.Color = Color.Black;
                ACanvas.Pen.Style = HCPenStyle.psSolid;
            }
            finally
            {
                ACanvas.Pen.EndUpdate();
            }

            ACanvas.MoveTo(FStartPt.X + this.DrawRect.Left, FStartPt.Y + this.DrawRect.Top);
            ACanvas.LineTo(FEndPt.X + this.DrawRect.Left, FEndPt.Y + this.DrawRect.Top);

            if ((this.Active) && (!APaintInfo.Print))  // 激活
            {
                ACanvas.Rectangle(FStartPt.X + this.DrawRect.Left - PointSize, FStartPt.Y + this.DrawRect.Top - PointSize,
                                  FStartPt.X + this.DrawRect.Left + PointSize, FStartPt.Y + this.DrawRect.Top + PointSize);
                ACanvas.Rectangle(FEndPt.X + this.DrawRect.Left - PointSize, FEndPt.Y + this.DrawRect.Top - PointSize,
                                  FEndPt.X + this.DrawRect.Left + PointSize, FEndPt.Y + this.DrawRect.Top + PointSize);
            }
        }
Beispiel #5
0
        public override void PaintTo(HCCanvas aCanvas, RECT aRect, PaintInfo aPaintInfo)
        {
            aCanvas.Pen.BeginUpdate();
            try
            {
                aCanvas.Pen.Color = Color;
                aCanvas.Pen.Width = FWidth;
                aCanvas.Pen.Style = FLineStyle;
            }
            finally
            {
                aCanvas.Pen.EndUpdate();
            }

            aCanvas.MoveTo(FPoints[0].X + aRect.Left, FPoints[0].Y + aRect.Top);
            for (int i = 1; i < FPoints.Count; i++)
            {
                aCanvas.LineTo(FPoints[i].X + aRect.Left, FPoints[i].Y + aRect.Top);
            }

            if (FPoints.Count > 1)  // 首尾相连
            {
                aCanvas.LineTo(FPoints[0].X + aRect.Left, FPoints[0].Y + aRect.Top);
            }

            if ((!aPaintInfo.Print) && this.Active)
            {
                PaintAnchor(aCanvas, aRect);
            }
        }
Beispiel #6
0
        protected override void DoPaint(HCStyle AStyle, RECT ADrawRect, int ADataDrawTop, int ADataDrawBottom,
                                        int ADataScreenTop, int ADataScreenBottom, HCCanvas ACanvas, PaintInfo APaintInfo)
        {
            base.DoPaint(AStyle, ADrawRect, ADataDrawTop, ADataDrawBottom, ADataScreenTop,
                         ADataScreenBottom, ACanvas, APaintInfo);

            FButtonDrawRect = FButtonRect;
            FButtonDrawRect.Offset(ADrawRect.Left, ADrawRect.Top);
            if (FMouseInButton)
            {
                ACanvas.Brush.Color = HC.clMenu;
            }
            else
            {
                ACanvas.Brush.Color = HC.clWindow;
            }

            ACanvas.FillRect(FButtonDrawRect);
            ACanvas.Pen.Color = Color.Black;
            int vLeft = FButtonDrawRect.Left + (BTNWIDTH - 7) / 2;
            int vTop  = FButtonDrawRect.Top + (FButtonDrawRect.Height - 4) / 2;

            for (int i = 0; i <= 3; i++)
            {
                ACanvas.MoveTo(vLeft, vTop);
                ACanvas.LineTo(vLeft + 7 - i - i, vTop);
                vLeft++;
                vTop++;
            }
        }
Beispiel #7
0
        private void PaintLine(HCCanvas canvas, RECT drawRect)
        {
            int vTop = (drawRect.Top + drawRect.Bottom) / 2;

            canvas.MoveTo(drawRect.Left, vTop);
            canvas.LineTo(drawRect.Right, vTop);
        }
        protected override void DoPaint(HCStyle aStyle, RECT aDrawRect, int aDataDrawTop, int aDataDrawBottom,
                                        int aDataScreenTop, int aDataScreenBottom, HCCanvas aCanvas, PaintInfo aPaintInfo)
        {
            base.DoPaint(aStyle, aDrawRect, aDataDrawTop, aDataDrawBottom, aDataScreenTop, aDataScreenBottom,
                         aCanvas, aPaintInfo);

            if (!aPaintInfo.Print)
            {
                if (FMarkType == View.MarkType.cmtBeg)
                {
                    aCanvas.Pen.BeginUpdate();
                    try
                    {
                        aCanvas.Pen.Width = 1;
                        aCanvas.Pen.Style = HCPenStyle.psSolid;
                        aCanvas.Pen.Color = HC.clActiveBorder;
                    }
                    finally
                    {
                        aCanvas.Pen.EndUpdate();
                    }
                    aCanvas.MoveTo(aDrawRect.Left + 2, aDrawRect.Top - 1);
                    aCanvas.LineTo(aDrawRect.Left, aDrawRect.Top - 1);
                    aCanvas.LineTo(aDrawRect.Left, aDrawRect.Bottom + 1);
                    aCanvas.LineTo(aDrawRect.Left + 2, aDrawRect.Bottom + 1);
                }
                else
                {
                    aCanvas.Pen.BeginUpdate();
                    try
                    {
                        aCanvas.Pen.Width = 1;
                        aCanvas.Pen.Style = HCPenStyle.psSolid;
                        aCanvas.Pen.Color = HC.clActiveBorder;
                    }
                    finally
                    {
                        aCanvas.Pen.EndUpdate();
                    }

                    aCanvas.MoveTo(aDrawRect.Right - 2, aDrawRect.Top - 1);
                    aCanvas.LineTo(aDrawRect.Right, aDrawRect.Top - 1);
                    aCanvas.LineTo(aDrawRect.Right, aDrawRect.Bottom + 1);
                    aCanvas.LineTo(aDrawRect.Right - 2, aDrawRect.Bottom + 1);
                }
            }
        }
Beispiel #9
0
        protected override void DoPaint(HCStyle AStyle, RECT ADrawRect,
                                        int ADataDrawTop, int ADataDrawBottom, int ADataScreenTop, int ADataScreenBottom,
                                        HCCanvas ACanvas, PaintInfo APaintInfo)
        {
            base.DoPaint(AStyle, ADrawRect, ADataDrawTop, ADataDrawBottom, ADataScreenTop, ADataScreenBottom,
                         ACanvas, APaintInfo);

            if (!APaintInfo.Print)
            {
                if (FMarkType == View.MarkType.cmtBeg)
                {
                    ACanvas.Pen.BeginUpdate();
                    try
                    {
                        ACanvas.Pen.Style = HCPenStyle.psSolid;
                        ACanvas.Pen.Color = HC.clActiveBorder;
                    }
                    finally
                    {
                        ACanvas.Pen.EndUpdate();
                    }
                    ACanvas.MoveTo(ADrawRect.Left + 2, ADrawRect.Top - 1);
                    ACanvas.LineTo(ADrawRect.Left, ADrawRect.Top - 1);
                    ACanvas.LineTo(ADrawRect.Left, ADrawRect.Bottom + 1);
                    ACanvas.LineTo(ADrawRect.Left + 2, ADrawRect.Bottom + 1);
                }
                else
                {
                    ACanvas.Pen.BeginUpdate();
                    try
                    {
                        ACanvas.Pen.Style = HCPenStyle.psSolid;
                        ACanvas.Pen.Color = HC.clActiveBorder;
                    }
                    finally
                    {
                        ACanvas.Pen.EndUpdate();
                    }

                    ACanvas.MoveTo(ADrawRect.Right - 2, ADrawRect.Top - 1);
                    ACanvas.LineTo(ADrawRect.Right, ADrawRect.Top - 1);
                    ACanvas.LineTo(ADrawRect.Right, ADrawRect.Bottom + 1);
                    ACanvas.LineTo(ADrawRect.Right - 2, ADrawRect.Bottom + 1);
                }
            }
        }
Beispiel #10
0
        private void DrawLineLastMrak(HCCanvas aCanvas, RECT aDrawRect, PaintInfo aPaintInfo)
        {
            aCanvas.Pen.BeginUpdate();
            try
            {
                aCanvas.Pen.Width = 1;
                aCanvas.Pen.Style = HCPenStyle.psSolid;
                aCanvas.Pen.Color = HC.clActiveBorder;
            }
            finally
            {
                aCanvas.Pen.EndUpdate();
            }

            if (aPaintInfo.ScaleX != 1)
            {
                SIZE vPt = new SIZE();
                GDI.SetViewportExtEx(aCanvas.Handle, aPaintInfo.WindowWidth, aPaintInfo.WindowHeight, ref vPt);
                try
                {
                    aCanvas.MoveTo(aPaintInfo.GetScaleX(aDrawRect.Right) + 4, aPaintInfo.GetScaleY(aDrawRect.Bottom) - 8);
                    aCanvas.LineTo(aPaintInfo.GetScaleX(aDrawRect.Right) + 6, aPaintInfo.GetScaleY(aDrawRect.Bottom) - 8);
                    aCanvas.LineTo(aPaintInfo.GetScaleX(aDrawRect.Right) + 6, aPaintInfo.GetScaleY(aDrawRect.Bottom) - 3);

                    aCanvas.MoveTo(aPaintInfo.GetScaleX(aDrawRect.Right), aPaintInfo.GetScaleY(aDrawRect.Bottom) - 3);
                    aCanvas.LineTo(aPaintInfo.GetScaleX(aDrawRect.Right) + 6, aPaintInfo.GetScaleY(aDrawRect.Bottom) - 3);

                    aCanvas.MoveTo(aPaintInfo.GetScaleX(aDrawRect.Right) + 1, aPaintInfo.GetScaleY(aDrawRect.Bottom) - 4);
                    aCanvas.LineTo(aPaintInfo.GetScaleX(aDrawRect.Right) + 1, aPaintInfo.GetScaleY(aDrawRect.Bottom) - 1);

                    aCanvas.MoveTo(aPaintInfo.GetScaleX(aDrawRect.Right) + 2, aPaintInfo.GetScaleY(aDrawRect.Bottom) - 5);
                    aCanvas.LineTo(aPaintInfo.GetScaleX(aDrawRect.Right) + 2, aPaintInfo.GetScaleY(aDrawRect.Bottom));
                }
                finally
                {
                    GDI.SetViewportExtEx(aCanvas.Handle, aPaintInfo.GetScaleX(aPaintInfo.WindowWidth),
                                         aPaintInfo.GetScaleY(aPaintInfo.WindowHeight), ref vPt);
                }
            }
            else
            {
                aCanvas.MoveTo(aDrawRect.Right + 4, aDrawRect.Bottom - 8);
                aCanvas.LineTo(aDrawRect.Right + 6, aDrawRect.Bottom - 8);
                aCanvas.LineTo(aDrawRect.Right + 6, aDrawRect.Bottom - 3);

                aCanvas.MoveTo(aDrawRect.Right, aDrawRect.Bottom - 3);
                aCanvas.LineTo(aDrawRect.Right + 6, aDrawRect.Bottom - 3);

                aCanvas.MoveTo(aDrawRect.Right + 1, aDrawRect.Bottom - 4);
                aCanvas.LineTo(aDrawRect.Right + 1, aDrawRect.Bottom - 1);

                aCanvas.MoveTo(aDrawRect.Right + 2, aDrawRect.Bottom - 5);
                aCanvas.LineTo(aDrawRect.Right + 2, aDrawRect.Bottom);
            }
        }
Beispiel #11
0
        public override void PaintTop(HCCanvas aCanvas)
        {
            base.PaintTop(aCanvas);

            aCanvas.Pen.Width = 1;
            if (MarkType == View.MarkType.cmtBeg)
            {
                aCanvas.Pen.BeginUpdate();
                try
                {
                    aCanvas.Pen.Width = 1;
                    aCanvas.Pen.Style = HCPenStyle.psSolid;
                    aCanvas.Pen.Color = Color.FromArgb(255, 0, 0);
                }
                finally
                {
                    aCanvas.Pen.EndUpdate();
                }

                //aCanvas.MoveTo(FDrawRect.Left + 2, FDrawRect.Top - 1);
                aCanvas.MoveTo(FDrawRect.Left, FDrawRect.Top - 1);
                aCanvas.LineTo(FDrawRect.Left, FDrawRect.Bottom + 1);
                //aCanvas.LineTo(FDrawRect.Left + 2, FDrawRect.Bottom + 1);
            }
            else
            {
                aCanvas.Pen.BeginUpdate();
                try
                {
                    aCanvas.Pen.Width = 1;
                    aCanvas.Pen.Style = HCPenStyle.psSolid;
                    aCanvas.Pen.Color = Color.FromArgb(255, 0, 0);
                }
                finally
                {
                    aCanvas.Pen.EndUpdate();
                }

                //aCanvas.MoveTo(FDrawRect.Right - 2, FDrawRect.Top - 1);
                aCanvas.MoveTo(FDrawRect.Right, FDrawRect.Top - 1);
                aCanvas.LineTo(FDrawRect.Right, FDrawRect.Bottom + 1);
                //aCanvas.LineTo(FDrawRect.Right - 2, FDrawRect.Bottom + 1);
            }
        }
Beispiel #12
0
        protected override void DoDrawItemPaintAfter(HCCustomData aData, int aItemNo, int aDrawItemNo, RECT aDrawRect, RECT aClearRect,
                                                     int aDataDrawLeft, int aDataDrawRight, int aDataDrawBottom, int aDataScreenTop, int aDataScreenBottom,
                                                     HCCanvas ACanvas, PaintInfo APaintInfo)
        {
            base.DoDrawItemPaintAfter(aData, aItemNo, aDrawItemNo, aDrawRect, aClearRect, aDataDrawLeft, aDataDrawRight,
                                      aDataDrawBottom, aDataScreenTop, aDataScreenBottom, ACanvas, APaintInfo);

            if (FShowUnderLine)
            {
                if (DrawItems[aDrawItemNo].LineFirst)
                {
                    ACanvas.Pen.BeginUpdate();
                    try
                    {
                        ACanvas.Pen.Color = Color.Black;
                        ACanvas.Pen.Style = HCPenStyle.psSolid;
                    }
                    finally
                    {
                        ACanvas.Pen.EndUpdate();
                    }

                    ACanvas.MoveTo(aDataDrawLeft, aDrawRect.Top - 1);
                    ACanvas.LineTo(aDataDrawLeft + this.Width, aDrawRect.Top - 1);
                }

                if (aDrawItemNo == DrawItems.Count - 1)
                {
                    ACanvas.Pen.BeginUpdate();
                    try
                    {
                        ACanvas.Pen.Color = Color.Black;
                        ACanvas.Pen.Style = HCPenStyle.psSolid;
                    }
                    finally
                    {
                        ACanvas.Pen.EndUpdate();
                    }

                    ACanvas.MoveTo(aDataDrawLeft, aDrawRect.Bottom);
                    ACanvas.LineTo(aDataDrawLeft + this.Width, aDrawRect.Bottom);
                }
            }
        }
Beispiel #13
0
        public static void HCDrawArrow(HCCanvas canvas, Color color, int left, int top, byte type)
        {
            switch (type)
            {
            case 0:      // 上
                canvas.Pen.Color = color;
                canvas.MoveTo(left, top);
                canvas.LineTo(left - 1, top);
                canvas.MoveTo(left - 1, top + 1);
                canvas.LineTo(left + 2, top + 1);
                canvas.MoveTo(left - 2, top + 2);
                canvas.LineTo(left + 3, top + 2);
                canvas.MoveTo(left - 3, top + 3);
                canvas.LineTo(left + 4, top + 3);
                canvas.MoveTo(left - 4, top + 4);
                canvas.LineTo(left + 5, top + 4);
                break;

            case 1:      // 下
                canvas.Pen.Color = color;
                canvas.MoveTo(left, top);
                canvas.LineTo(left - 1, top);
                canvas.MoveTo(left - 1, top - 1);
                canvas.LineTo(left + 2, top - 1);
                canvas.MoveTo(left - 2, top - 2);
                canvas.LineTo(left + 3, top - 2);
                canvas.MoveTo(left - 3, top - 3);
                canvas.LineTo(left + 4, top - 3);
                canvas.MoveTo(left - 4, top - 4);
                canvas.LineTo(left + 5, top - 4);
                break;

            case 2:      // 左
                break;

            case 3:      // 右
                break;
            }
        }
Beispiel #14
0
        private void DrawLineLastMrak(HCCanvas ACanvas, RECT ADrawRect, PaintInfo APaintInfo)
        {
            ACanvas.Pen.BeginUpdate();
            try
            {
                ACanvas.Pen.Width = 1;
                ACanvas.Pen.Style = HCPenStyle.psSolid;
                ACanvas.Pen.Color = HC.clActiveBorder;
            }
            finally
            {
                ACanvas.Pen.EndUpdate();
            }

            SIZE vPt = new SIZE();

            GDI.SetViewportExtEx(ACanvas.Handle, APaintInfo.WindowWidth, APaintInfo.WindowHeight, ref vPt);
            try
            {
                ACanvas.MoveTo(APaintInfo.GetScaleX(ADrawRect.Right) + 4,
                               APaintInfo.GetScaleY(ADrawRect.Bottom) - 8);
                ACanvas.LineTo(APaintInfo.GetScaleX(ADrawRect.Right) + 6, APaintInfo.GetScaleY(ADrawRect.Bottom) - 8);
                ACanvas.LineTo(APaintInfo.GetScaleX(ADrawRect.Right) + 6, APaintInfo.GetScaleY(ADrawRect.Bottom) - 3);
                ACanvas.MoveTo(APaintInfo.GetScaleX(ADrawRect.Right), APaintInfo.GetScaleY(ADrawRect.Bottom) - 3);
                ACanvas.LineTo(APaintInfo.GetScaleX(ADrawRect.Right) + 6, APaintInfo.GetScaleY(ADrawRect.Bottom) - 3);
                ACanvas.MoveTo(APaintInfo.GetScaleX(ADrawRect.Right) + 1, APaintInfo.GetScaleY(ADrawRect.Bottom) - 4);
                ACanvas.LineTo(APaintInfo.GetScaleX(ADrawRect.Right) + 1, APaintInfo.GetScaleY(ADrawRect.Bottom) - 1);
                ACanvas.MoveTo(APaintInfo.GetScaleX(ADrawRect.Right) + 2, APaintInfo.GetScaleY(ADrawRect.Bottom) - 5);
                ACanvas.LineTo(APaintInfo.GetScaleX(ADrawRect.Right) + 2, APaintInfo.GetScaleY(ADrawRect.Bottom));
            }
            finally
            {
                GDI.SetViewportExtEx(ACanvas.Handle, APaintInfo.GetScaleX(APaintInfo.WindowWidth),
                                     APaintInfo.GetScaleY(APaintInfo.WindowHeight), ref vPt);
            }
        }
Beispiel #15
0
        public void DrawNoScaleLine(HCCanvas aCanvas, int x1, int y1, int x2, int y2)
        {
            SIZE size = new SIZE();

            GDI.SetViewportExtEx(aCanvas.Handle, FWindowWidth, FWindowHeight, ref size);
            try
            {
                aCanvas.MoveTo(GetScaleX(x1), GetScaleY(y1));
                aCanvas.LineTo(GetScaleX(x2), GetScaleY(y2));
            }
            finally
            {
                GDI.SetViewportExtEx(aCanvas.Handle, (int)Math.Round(FWindowWidth * FScaleX),
                                     (int)Math.Round(FWindowHeight * FScaleY), ref size);
            }
        }
Beispiel #16
0
        protected override void DoPaint(HCStyle aStyle, RECT aDrawRect, int aDataDrawTop, int aDataDrawBottom, int aDataScreenTop, int aDataScreenBottom, HCCanvas aCanvas, PaintInfo aPaintInfo)
        {
            aCanvas.Pen.BeginUpdate();
            try
            {
                aCanvas.Pen.Width = FLineHeight;
                aCanvas.Pen.Style = FLineStyle;
                aCanvas.Pen.Color = Color.Black;
            }
            finally
            {
                aCanvas.Pen.EndUpdate();
            }

            int vTop = (aDrawRect.Top + aDrawRect.Bottom) / 2;

            aCanvas.MoveTo(aDrawRect.Left, vTop);
            aCanvas.LineTo(aDrawRect.Right, vTop);
        }
Beispiel #17
0
        public void DrawNoScaleLine(HCCanvas aCanvas, Point[] aPoints)
        {
            SIZE size = new SIZE();

            GDI.SetViewportExtEx(aCanvas.Handle, FWindowWidth, FWindowHeight, ref size);
            try
            {
                aCanvas.MoveTo(GetScaleX(aPoints[0].X), GetScaleY(aPoints[0].Y));
                for (int i = 1; i < aPoints.Length; i++)
                {
                    aCanvas.LineTo(GetScaleX(aPoints[i].X), GetScaleY(aPoints[i].Y));
                }
            }
            finally
            {
                GDI.SetViewportExtEx(aCanvas.Handle, (int)Math.Round(FWindowWidth * FScaleX),
                                     (int)Math.Round(FWindowHeight * FScaleY), ref size);
            }
        }
Beispiel #18
0
        protected override void DoPaint(HCStyle AStyle, RECT ADrawRect, int ADataDrawTop, int ADataDrawBottom, int ADataScreenTop, int ADataScreenBottom, HCCanvas ACanvas, PaintInfo APaintInfo)
        {
            ACanvas.Pen.BeginUpdate();
            try
            {
                ACanvas.Pen.Width = FLineHeight;
                ACanvas.Pen.Style = FLineStyle;
                ACanvas.Pen.Color = Color.Black;
            }
            finally
            {
                ACanvas.Pen.EndUpdate();
            }

            int vTop = (ADrawRect.Top + ADrawRect.Bottom) / 2;

            ACanvas.MoveTo(ADrawRect.Left, vTop);
            ACanvas.LineTo(ADrawRect.Right, vTop);
        }
Beispiel #19
0
        public override void PaintTo(HCCanvas aCanvas, RECT aRect, PaintInfo aPaintInfo)
        {
            aCanvas.Pen.BeginUpdate();
            try
            {
                aCanvas.Pen.Color = Color;
                aCanvas.Pen.Width = FWidth;
                aCanvas.Pen.Style = FLineStyle;
            }
            finally
            {
                aCanvas.Pen.EndUpdate();
            }

            aCanvas.MoveTo(FStartPt.X + aRect.Left, FStartPt.Y + aRect.Top);
            aCanvas.LineTo(FEndPt.X + aRect.Left, FEndPt.Y + aRect.Top);

            if ((!aPaintInfo.Print) && (this.Active))
            {
                PaintAnchor(aCanvas, aRect);
            }
        }
Beispiel #20
0
        protected override void DoPaint(HCStyle aStyle, RECT aDrawRect, int aDataDrawTop, int aDataDrawBottom,
                                        int aDataScreenTop, int aDataScreenBottom, HCCanvas aCanvas, PaintInfo aPaintInfo)
        {
            if (this.Active && (!aPaintInfo.Print))
            {
                aCanvas.Brush.Color = HC.clBtnFace;
                aCanvas.FillRect(aDrawRect);
            }

            aCanvas.Pen.Color = Color.Black;
            aCanvas.MoveTo(aDrawRect.Left + FLeftRect.Right + Padding, aDrawRect.Top + TopRect.Bottom + Padding);
            aCanvas.LineTo(aDrawRect.Left + FRightRect.Left - Padding, aDrawRect.Top + TopRect.Bottom + Padding);

            if (!aPaintInfo.Print)
            {
                RECT vFocusRect = new RECT();

                if (FActiveArea != ExpressArea.ceaNone)
                {
                    switch (FActiveArea)
                    {
                    case ExpressArea.ceaLeft:
                        vFocusRect = FLeftRect;
                        break;

                    case ExpressArea.ceaTop:
                        vFocusRect = TopRect;
                        break;

                    case ExpressArea.ceaRight:
                        vFocusRect = FRightRect;
                        break;

                    case ExpressArea.ceaBottom:
                        vFocusRect = BottomRect;
                        break;
                    }

                    vFocusRect.Offset(aDrawRect.Left, aDrawRect.Top);
                    vFocusRect.Inflate(2, 2);
                    aCanvas.Pen.Color = Color.Blue;
                    aCanvas.Rectangle(vFocusRect);
                }

                if ((FMouseMoveArea != ExpressArea.ceaNone) && (FMouseMoveArea != FActiveArea))
                {
                    switch (FMouseMoveArea)
                    {
                    case ExpressArea.ceaLeft:
                        vFocusRect = FLeftRect;
                        break;

                    case ExpressArea.ceaTop:
                        vFocusRect = TopRect;
                        break;

                    case ExpressArea.ceaRight:
                        vFocusRect = FRightRect;
                        break;

                    case ExpressArea.ceaBottom:
                        vFocusRect = BottomRect;
                        break;
                    }

                    vFocusRect.Offset(aDrawRect.Left, aDrawRect.Top);
                    vFocusRect.Inflate(2, 2);
                    aCanvas.Pen.Color = HC.clMedGray;
                    aCanvas.Rectangle(vFocusRect);
                }
            }

            aStyle.TextStyles[TextStyleNo].ApplyStyle(aCanvas, aPaintInfo.ScaleY / aPaintInfo.Zoom);
            aCanvas.TextOut(aDrawRect.Left + FLeftRect.Left, aDrawRect.Top + FLeftRect.Top, FLeftText);
            aCanvas.TextOut(aDrawRect.Left + TopRect.Left, aDrawRect.Top + TopRect.Top, TopText);
            aCanvas.TextOut(aDrawRect.Left + FRightRect.Left, aDrawRect.Top + FRightRect.Top, FRightText);
            aCanvas.TextOut(aDrawRect.Left + BottomRect.Left, aDrawRect.Top + BottomRect.Top, BottomText);
        }
Beispiel #21
0
        protected override void DoPaint(HCStyle aStyle, RECT aDrawRect, int aDataDrawTop, int aDataDrawBottom,
                                        int aDataScreenTop, int aDataScreenBottom, HCCanvas aCanvas, PaintInfo aPaintInfo)
        {
            base.DoPaint(aStyle, aDrawRect, aDataDrawTop, aDataDrawBottom, aDataScreenTop,
                         aDataScreenBottom, aCanvas, aPaintInfo);

            if (!aPaintInfo.Print)
            {
                if (FReadOnly)
                {
                    aCanvas.Brush.Color = HC.clBtnFace;
                    aCanvas.FillRect(aDrawRect);
                }
                else
                if (this.IsSelectComplate)
                {
                    aCanvas.Brush.Color = aStyle.SelColor;
                    aCanvas.FillRect(aDrawRect);
                }

                if (SelectTextExists())
                {
                    aCanvas.Brush.Color = aStyle.SelColor;
                    int vLeft  = GetCharDrawLeft(FCaretOffset);
                    int vRight = GetCharDrawLeft(FSelEnd);
                    vLeft  = Math.Max(0, Math.Min(vLeft, Width));
                    vRight = Math.Max(0, Math.Min(vRight, Width));
                    aCanvas.FillRect(new RECT(aDrawRect.Left + vLeft, aDrawRect.Top, aDrawRect.Left + vRight, aDrawRect.Bottom));
                }
            }

            aStyle.TextStyles[TextStyleNo].ApplyStyle(aCanvas, aPaintInfo.ScaleY / aPaintInfo.Zoom);

            if (!this.AutoSize)
            {
                aCanvas.TextRect(aDrawRect, aDrawRect.Left + FPaddingLeft - FLeftOffset, aDrawRect.Top + FPaddingTop, FText);
            }
            else
            {
                aCanvas.TextOut(aDrawRect.Left + FPaddingLeft, aDrawRect.Top + FPaddingTop, FText);
            }

            if (aPaintInfo.Print && FPrintOnlyText)
            {
                return;
            }

            if (FBorderSides.Value > 0)
            {
                if (FMouseIn || Active)
                {
                    aCanvas.Pen.Color = Color.Blue;
                }
                else  // 鼠标不在其中或打印
                {
                    aCanvas.Pen.Color = Color.Black;
                }

                aCanvas.Pen.Width = FBorderWidth;
                aCanvas.Pen.Style = HCPenStyle.psSolid;

                if (FBorderSides.Contains((byte)BorderSide.cbsLeft))
                {
                    aCanvas.MoveTo(aDrawRect.Left, aDrawRect.Top);
                    aCanvas.LineTo(aDrawRect.Left, aDrawRect.Bottom);
                }

                if (FBorderSides.Contains((byte)BorderSide.cbsTop))
                {
                    aCanvas.MoveTo(aDrawRect.Left, aDrawRect.Top);
                    aCanvas.LineTo(aDrawRect.Right, aDrawRect.Top);
                }

                if (FBorderSides.Contains((byte)BorderSide.cbsRight))
                {
                    aCanvas.MoveTo(aDrawRect.Right - 1, aDrawRect.Top);
                    aCanvas.LineTo(aDrawRect.Right - 1, aDrawRect.Bottom);
                }

                if (FBorderSides.Contains((byte)BorderSide.cbsBottom))
                {
                    aCanvas.MoveTo(aDrawRect.Left, aDrawRect.Bottom - 1);
                    aCanvas.LineTo(aDrawRect.Right, aDrawRect.Bottom - 1);
                }
            }
        }
Beispiel #22
0
        protected override void DoPaint(HCStyle aStyle, RECT aDrawRect, int aDataDrawTop, int aDataDrawBottom,
                                        int aDataScreenTop, int aDataScreenBottom, HCCanvas aCanvas, PaintInfo aPaintInfo)
        {
            if (this.Active && (!aPaintInfo.Print))
            {
                aCanvas.Brush.Color = HC.clBtnFace;
                aCanvas.FillRect(aDrawRect);
            }

            if (!FLineHide)  // 分数线
            {
                aCanvas.Pen.Color = Color.Black;
                aCanvas.MoveTo(aDrawRect.Left + FPadding, aDrawRect.Top + FTopRect.Bottom + FPadding);
                aCanvas.LineTo(aDrawRect.Left + Width - FPadding, aDrawRect.Top + FTopRect.Bottom + FPadding);
            }

            if (!aPaintInfo.Print)
            {
                RECT vFocusRect = new RECT();

                if (FActiveArea != ExpressArea.ceaNone)
                {
                    if (FActiveArea == ExpressArea.ceaTop)
                    {
                        vFocusRect = FTopRect;
                    }
                    else
                    if (FActiveArea == ExpressArea.ceaBottom)
                    {
                        vFocusRect = FBottomRect;
                    }

                    vFocusRect.Offset(aDrawRect.Left, aDrawRect.Top);
                    vFocusRect.Inflate(2, 2);
                    aCanvas.Pen.Color = Color.Blue;
                    aCanvas.Rectangle(vFocusRect);
                }

                if ((FMouseMoveArea != ExpressArea.ceaNone) && (FMouseMoveArea != FActiveArea))
                {
                    if (FMouseMoveArea == ExpressArea.ceaTop)
                    {
                        vFocusRect = FTopRect;
                    }
                    else
                    if (FMouseMoveArea == ExpressArea.ceaBottom)
                    {
                        vFocusRect = FBottomRect;
                    }

                    vFocusRect.Offset(aDrawRect.Left, aDrawRect.Top);
                    vFocusRect.Inflate(2, 2);
                    aCanvas.Pen.Color = HC.clMedGray;
                    aCanvas.Rectangle(vFocusRect);
                }
            }

            aStyle.TextStyles[TextStyleNo].ApplyStyle(aCanvas, aPaintInfo.ScaleY / aPaintInfo.Zoom);
            aCanvas.TextOut(aDrawRect.Left + FTopRect.Left, aDrawRect.Top + FTopRect.Top, FTopText);
            aCanvas.TextOut(aDrawRect.Left + FBottomRect.Left, aDrawRect.Top + FBottomRect.Top, FBottomText);
        }
Beispiel #23
0
        private bool FShowLineNo;           // 行号

        protected override void DoDrawItemPaintBefor(HCCustomData aData, int aItemNo, int aDrawItemNo,
                                                     RECT aDrawRect, RECT aClearRect, int aDataDrawLeft, int aDataDrawRight, int aDataDrawBottom, int aDataScreenTop,
                                                     int ADataScreenBottom, HCCanvas ACanvas, PaintInfo APaintInfo)
        {
            base.DoDrawItemPaintBefor(aData, aItemNo, aDrawItemNo, aDrawRect, aClearRect, aDataDrawLeft, aDataDrawRight,
                                      aDataDrawBottom, aDataScreenTop, ADataScreenBottom, ACanvas, APaintInfo);

            if (!APaintInfo.Print)
            {
                if (FShowLineActiveMark)
                {
                    if (aDrawItemNo == GetSelectStartDrawItemNo())
                    {
                        ACanvas.Pen.BeginUpdate();
                        try
                        {
                            ACanvas.Pen.Color = Color.Blue;
                            ACanvas.Pen.Style = HCPenStyle.psSolid;
                        }
                        finally
                        {
                            ACanvas.Pen.EndUpdate();
                        }

                        int vTop = aDrawRect.Top + DrawItems[aDrawItemNo].Height / 2;
                        ACanvas.MoveTo(aDataDrawLeft - 10, vTop);
                        ACanvas.LineTo(aDataDrawLeft - 11, vTop);
                        ACanvas.MoveTo(aDataDrawLeft - 11, vTop - 1);
                        ACanvas.LineTo(aDataDrawLeft - 11, vTop + 2);
                        ACanvas.MoveTo(aDataDrawLeft - 12, vTop - 2);
                        ACanvas.LineTo(aDataDrawLeft - 12, vTop + 3);
                        ACanvas.MoveTo(aDataDrawLeft - 13, vTop - 3);
                        ACanvas.LineTo(aDataDrawLeft - 13, vTop + 4);
                        ACanvas.MoveTo(aDataDrawLeft - 14, vTop - 4);
                        ACanvas.LineTo(aDataDrawLeft - 14, vTop + 5);
                        ACanvas.MoveTo(aDataDrawLeft - 15, vTop - 2);
                        ACanvas.LineTo(aDataDrawLeft - 15, vTop + 3);
                        ACanvas.MoveTo(aDataDrawLeft - 16, vTop - 2);
                        ACanvas.LineTo(aDataDrawLeft - 16, vTop + 3);
                    }
                }

                if (FShowUnderLine)
                {
                    if (DrawItems[aDrawItemNo].LineFirst)
                    {
                        ACanvas.Pen.BeginUpdate();
                        try
                        {
                            ACanvas.Pen.Color = Color.Black;
                            ACanvas.Pen.Style = HCPenStyle.psSolid;
                        }
                        finally
                        {
                            ACanvas.Pen.EndUpdate();
                        }

                        ACanvas.MoveTo(aDataDrawLeft, aDrawRect.Bottom);
                        ACanvas.LineTo(aDataDrawLeft + this.Width, aDrawRect.Bottom);
                    }
                }

                if (FShowLineNo)
                {
                    if (DrawItems[aDrawItemNo].LineFirst)
                    {
                        int vLineNo = 0;
                        for (int i = 0; i <= aDrawItemNo; i++)
                        {
                            if (DrawItems[i].LineFirst)
                            {
                                vLineNo++;
                            }
                        }

                        // 20181103
                        IntPtr vOldFont = ACanvas.Font.Handle;
                        try
                        {
                            using (HCFont vFont = new HCFont())
                            {
                                vFont.BeginUpdate();
                                try
                                {
                                    vFont.Size   = 10;
                                    vFont.Family = "Courier New";
                                    vFont.Color  = Color.FromArgb(180, 180, 180);
                                }
                                finally
                                {
                                    vFont.EndUpdate();
                                }

                                ACanvas.Brush.Style = HCBrushStyle.bsClear;
                                GDI.SelectObject(ACanvas.Handle, vFont.Handle);
                                int vTop = aDrawRect.Top + (aDrawRect.Bottom - aDrawRect.Top - 16) / 2;
                                ACanvas.TextOut(aDataDrawLeft - 50, vTop, vLineNo.ToString());
                            }
                        }
                        finally
                        {
                            GDI.SelectObject(ACanvas.Font.Handle, vOldFont);
                        }
                    }
                }
            }
        }
Beispiel #24
0
        public override void PaintToEx(HCCanvas aCanvas)
        {
            base.PaintToEx(aCanvas);

            if (this.Orientation == Orientation.oriVertical)  // 垂直滚动条
            {
                if (FRightBlank > 0)
                {
                    aCanvas.Brush.Color = Color.FromArgb(0x52, 0x59, 0x6B);
                    aCanvas.FillRect(new RECT(2, Height - FRightBlank + 2, Width - 2, Height - 2));

                    // 上按钮
                    aCanvas.Pen.Color = Color.FromArgb(0xAA, 0xAB, 0xB3);
                    int vX = (Width - 5) / 2;
                    int vY = Height - FRightBlank + 2 + ButtonSize - 9;
                    aCanvas.MoveTo(vX, vY);
                    aCanvas.LineTo(vX + 5, vY);
                    aCanvas.MoveTo(vX + 1, vY - 1);
                    aCanvas.LineTo(vX + 4, vY - 1);
                    aCanvas.MoveTo(vX + 2, vY - 2);
                    aCanvas.LineTo(vX + 3, vY - 2);

                    vY = vY - 3;
                    aCanvas.MoveTo(vX, vY);
                    aCanvas.LineTo(vX + 5, vY);
                    aCanvas.MoveTo(vX + 1, vY - 1);
                    aCanvas.LineTo(vX + 4, vY - 1);
                    aCanvas.MoveTo(vX + 2, vY - 2);
                    aCanvas.LineTo(vX + 3, vY - 2);

                    // 下按钮
                    vY = Height - FRightBlank + 2 + ButtonSize + 2 + 3;
                    aCanvas.MoveTo(vX, vY);
                    aCanvas.LineTo(vX + 5, vY);
                    aCanvas.MoveTo(vX + 1, vY + 1);
                    aCanvas.LineTo(vX + 4, vY + 1);
                    aCanvas.MoveTo(vX + 2, vY + 2);
                    aCanvas.LineTo(vX + 3, vY + 2);

                    vY = vY + 3;
                    aCanvas.MoveTo(vX, vY);
                    aCanvas.LineTo(vX + 5, vY);
                    aCanvas.MoveTo(vX + 1, vY + 1);
                    aCanvas.LineTo(vX + 4, vY + 1);
                    aCanvas.MoveTo(vX + 2, vY + 2);
                    aCanvas.LineTo(vX + 3, vY + 2);
                }
            }
        }