Beispiel #1
0
        public HCCanvas()
        {
            FPen           = new HCPen();
            FPen.OnChanged = DoPenChanged;

            FBrush           = new HCBrush();
            FBrush.OnChanged = DoBrushChanged;

            FFont           = new HCFont();
            FFont.OnChanged = DoFontChanged;
        }
Beispiel #2
0
        public HCCanvas()
        {
            IntPtr vDC = User.GetDC(IntPtr.Zero);

            try
            {
                ScreenLogPixels = GDI.GetDeviceCaps(vDC, GDI.LOGPIXELSY);
            }
            finally
            {
                User.ReleaseDC(IntPtr.Zero, vDC);
            }

            FPen           = new HCPen();
            FPen.OnChanged = DoPenChanged;

            FBrush           = new HCBrush();
            FBrush.OnChanged = DoBrushChanged;

            FFont           = new HCFont();
            FFont.OnChanged = DoFontChanged;
        }
Beispiel #3
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);
                        }
                    }
                }
            }
        }