Пример #1
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 (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);
            }
        }
        public override void PaintToEx(HCCanvas ACanvas)
        {
            base.PaintToEx(ACanvas);

            if (this.Orientation == Orientation.oriHorizontal)
            {
                if (FStatuses.Count > 0)
                {
                    ACanvas.Brush.Color = Color.FromArgb(0x52, 0x59, 0x6B);
                    ACanvas.FillRect(new RECT(2, 2, FLeftBtnRect.Left, this.Height - 2));
                    ACanvas.Font.BeginUpdate();
                    try
                    {
                        ACanvas.Font.Size             = 8;
                        ACanvas.Font.Color            = Color.FromArgb(0xD0, 0xD1, 0xD5);
                        ACanvas.Font.Family           = "Arial";
                        ACanvas.Font.FontStyles.Value = 0;
                    }
                    finally
                    {
                        ACanvas.Font.EndUpdate();
                    }

                    int    vLeft = 4;
                    string vText = "";
                    RECT   vRect = new RECT(0, 2, 0, Height - 2);
                    for (int i = 0; i < FStatuses.Count; i++)
                    {
                        vText       = FStatuses[i].Text;
                        vRect.Left  = vLeft;
                        vRect.Right = vLeft + FStatuses[i].Width;
                        ACanvas.TextRect(ref vRect, vText, User.DT_LEFT | User.DT_SINGLELINE | User.DT_VCENTER);
                        vLeft += FStatuses[i].Width + 2;
                    }
                }
            }
        }
Пример #3
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);
                }
            }
        }