コード例 #1
0
ファイル: SourceSupervisor.cs プロジェクト: yhtsnda/spark
        private PaintInfo GetPaintInfo(string primaryText)
        {
            var paintInfo = new PaintInfo();

            try
            {
                var sourceContext = new SourceContext(primaryText, 0, _path);
                var result        = _grammar.Nodes(new Position(sourceContext));

                paintInfo.Paint = result.Rest.GetPaint()
                                  .OfType <Paint <SparkTokenType> >()
                                  .Where(p => string.Equals(p.Begin.SourceContext.FileName, _path,
                                                            StringComparison.InvariantCultureIgnoreCase))
                                  .Select(p => new _SOURCEPAINTING
                {
                    start = p.Begin.Offset,
                    end   = p.End.Offset,
                    color = (int)p.Value
                })
                                  .ToArray();

                paintInfo.Count = paintInfo.Paint.Length;
            }
            catch (Exception ex)
            {
                paintInfo.ParseError = ex;
            }

            if (paintInfo.Count == 0)
            {
                paintInfo.Paint = new _SOURCEPAINTING[1];
            }
            return(paintInfo);
        }
コード例 #2
0
        public void sendPaintInfo(Point startPos, Point endPos, int pen_color)
        {
            //座標データをシリアライズ
            var sendData = new PaintInfo()
            {
                StartPos  = startPos,
                EndPos    = endPos,
                Pen_color = pen_color
            };
            var jsonString  = Util.Serialize(sendData);
            var sendToBytes = System.Text.Encoding.UTF8.GetBytes(jsonString);

            //独自パケット作成
            var mergedArray = Util.MergeByteArrays(new List <byte[]>
            {
                Util.ToBigEndianArray((ulong)sendToBytes.Length + 1, 4),
                new byte[] { Util.TypePos },
                sendToBytes
            });

            //全てのクライアントに送信
            lock (SyncClientSockets_)
            {
                foreach (var name in clinetList_.Keys)
                {
                    clinetList_[name].Send(mergedArray);
                }
            }
        }
コード例 #3
0
        private void entityEditControl1_PaintContent(object sender, PaintEventArgs e)
        {
            e.Graphics.SmoothingMode     = SmoothingMode.AntiAlias;
            e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;

            if (!(this.m_item is ItemBindingItem))
            {
                return;
            }

            ItemBindingItem item = (ItemBindingItem)this.m_item;
            Cell            cell = item.ContainerCell;

            if (cell == null)
            {
                return;
            }

            PaintInfo info = cell.GetPaintInfo();

            this.entityEditControl1.MemberBackColor = info.BackColor;
            this.entityEditControl1.MemberForeColor = info.ForeColor;

            int        nDelta = 8;
            RectangleF rect   = this.entityEditControl1.ContentControl.DisplayRectangle;

            rect.Inflate(nDelta, nDelta);

            cell.PaintBorder((long)rect.X,
                             (long)rect.Y,
                             (int)rect.Width,
                             (int)rect.Height,
                             e);
        }
コード例 #4
0
    public PaintAction(IList <EVertex> vertices, IList <ColorHSL> begin, IList <ColorHSL> end, HistorySystem s)
        : base(s)
    {
        paints = new PaintInfo[vertices.Count];

        for (int i = 0; i < vertices.Count; i++)
        {
            paints[i] = new PaintInfo(vertices[i], begin[i], end[i]);
        }
    }
コード例 #5
0
        private void btn_PaintSearch_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(tb_PaintSearcher.Text) || tb_PaintSearcher.Text.Length < 3)
            {
                return;
            }

            PaintList.Clear();
            foreach (var paint in _gameDB.SearchPaintsByName(tb_PaintSearcher.Text))
            {
                var colorBytes = BitConverter.GetBytes(paint.color);

                var paintC = new PaintInfo(paint.id, Color.FromRgb(colorBytes[0], colorBytes[1], colorBytes[2]), paint.name);
                PaintList.Add(paintC);
            }

            lv_PaintList.ItemsSource = null;
            lv_PaintList.ItemsSource = PaintList;
        }
コード例 #6
0
ファイル: HCEmrEdit.cs プロジェクト: ywscr/HCView-CSharp
        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)
        {
            if ((!aPaintInfo.Print) && (aData.Items[aItemNo] is DeItem))
            {
                DeItem vDeItem = aData.Items[aItemNo] as DeItem;
                if (vDeItem.IsElement)                         // 是数据元
                {
                    if ((vDeItem.MouseIn) || (vDeItem.Active)) // 鼠标移入和光标
                    {
                        if ((vDeItem.IsSelectPart) || (vDeItem.IsSelectComplate))
                        {
                        }
                        else
                        {
                            if (vDeItem[DeProp.Name] != vDeItem.Text)  // 已经填写过了
                            {
                                aCanvas.Brush.Color = FDeDoneColor;
                            }
                            else  // 没填写过
                            {
                                aCanvas.Brush.Color = FDeUnDoneColor;
                            }

                            aCanvas.FillRect(aDrawRect);
                        }
                    }
                }
                else  // 不是数据元
                {
                    if (FDesignMode && vDeItem.EditProtect)
                    {
                        aCanvas.Brush.Color = HC.View.HC.clBtnFace;
                        aCanvas.FillRect(aDrawRect);
                    }
                }
            }
        }
コード例 #7
0
        private void clearTexts() // clear all text boxes and lock all buttons
        {
            PaintInfo.Items.Clear();
            MakeText.Text        = "";
            YearUD.Value         = YearUD.Minimum;
            pntCodeText.Text     = "";
            PntNameText.Text     = "";
            ColorDrop.Text       = "";
            EditButton.Enabled   = false;
            AddButton.Enabled    = false;
            DeleteButton.Enabled = false;
            int cid = 0;

            for (int i = 0; i < colors.Length; i++)
            {
                if (colorLabel.Text == colors[i])
                {
                    cid = i + 1;
                }
            }
            SelectColors(cid); // Refresh List box values
            PaintInfo.Refresh();
        }
コード例 #8
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.View.HC.clBtnFace;
                aCanvas.FillRect(aDrawRect);
            }

            aStyle.TextStyles[TextStyleNo].ApplyStyle(aCanvas, aPaintInfo.ScaleY / aPaintInfo.Zoom);
            aCanvas.TextOut(aDrawRect.Left + LeftRect.Left, aDrawRect.Top + LeftRect.Top, LeftText);
            aCanvas.TextOut(aDrawRect.Left + TopRect.Left, aDrawRect.Top + TopRect.Top, TopText);
            aCanvas.TextOut(aDrawRect.Left + RightRect.Left, aDrawRect.Top + RightRect.Top, RightText);
            aCanvas.TextOut(aDrawRect.Left + BottomRect.Left, aDrawRect.Top + BottomRect.Top, BottomText);

            aCanvas.Pen.Color = Color.Black;
            aCanvas.DrawLine(aDrawRect.Left, aDrawRect.Top, aDrawRect.Right, aDrawRect.Bottom);
            aCanvas.DrawLine(aDrawRect.Right, aDrawRect.Top, aDrawRect.Left, aDrawRect.Bottom);

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

                if (FMouseIn)
                {
                    aCanvas.Pen.Color = Color.Gray;

                    vFocusRect = LeftRect;
                    vFocusRect.Offset(aDrawRect.Left, aDrawRect.Top);
                    vFocusRect.Inflate(2, 2);
                    aCanvas.Rectangle(vFocusRect);

                    vFocusRect = TopRect;
                    vFocusRect.Offset(aDrawRect.Left, aDrawRect.Top);
                    vFocusRect.Inflate(2, 2);
                    aCanvas.Rectangle(vFocusRect);

                    vFocusRect = RightRect;
                    vFocusRect.Offset(aDrawRect.Left, aDrawRect.Top);
                    vFocusRect.Inflate(2, 2);
                    aCanvas.Rectangle(vFocusRect);

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

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

                    case ExpressArea.ceaTop:
                        vFocusRect = TopRect;
                        break;

                    case ExpressArea.ceaRight:
                        vFocusRect = RightRect;
                        break;

                    default:
                        vFocusRect = BottomRect;
                        break;
                    }

                    vFocusRect.Offset(aDrawRect.Left, aDrawRect.Top);
                    vFocusRect.Inflate(2, 2);
                    aCanvas.Pen.Color = Color.Blue;
                    aCanvas.Rectangle(vFocusRect);
                }
            }
        }
コード例 #9
0
        private PaintInfo GetPaintInfo(string primaryText)
        {
            var paintInfo = new PaintInfo();
            try
            {
                var sourceContext = new SourceContext(primaryText, 0, _path);
                var result = _grammar.Nodes(new Position(sourceContext));

                paintInfo.Paint = result.Rest.GetPaint()
                    .OfType<Paint<SparkTokenType>>()
                    .Where(p => string.Equals(p.Begin.SourceContext.FileName, _path,
                                              StringComparison.InvariantCultureIgnoreCase))
                    .Select(p => new _SOURCEPAINTING
                                     {
                                         start = p.Begin.Offset,
                                         end = p.End.Offset,
                                         color = (int)p.Value
                                     })
                    .ToArray();

                paintInfo.Count = paintInfo.Paint.Length;
            }
            catch (Exception ex)
            {
                paintInfo.ParseError = ex;
            }

            if (paintInfo.Count == 0)
                paintInfo.Paint = new _SOURCEPAINTING[1];
            return paintInfo;
        }
コード例 #10
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.View.HC.clBtnFace;
                aCanvas.FillRect(aDrawRect);
            }

            aStyle.TextStyles[TextStyleNo].ApplyStyle(aCanvas, aPaintInfo.ScaleY / aPaintInfo.Zoom);
            if (FLeftTopText != "")
            {
                aCanvas.TextOut(aDrawRect.Left + FLeftTopRect.Left, aDrawRect.Top + FLeftTopRect.Top, FLeftTopText);
            }

            if (FLeftBottomText != "")
            {
                aCanvas.TextOut(aDrawRect.Left + FLeftBottomRect.Left, aDrawRect.Top + FLeftBottomRect.Top, FLeftBottomText);
            }

            if (FRightTopText != "")
            {
                aCanvas.TextOut(aDrawRect.Left + FRightTopRect.Left, aDrawRect.Top + FRightTopRect.Top, FRightTopText);
            }

            if (FRightBottomText != "")
            {
                aCanvas.TextOut(aDrawRect.Left + FRightBottomRect.Left, aDrawRect.Top + FRightBottomRect.Top, FRightBottomText);
            }

            // 十字线
            aCanvas.Pen.Color = Color.Black;
            aCanvas.MoveTo(aDrawRect.Left, aDrawRect.Top + FLeftTopRect.Bottom + FPadding);
            aCanvas.LineTo(aDrawRect.Right, aDrawRect.Top + FLeftTopRect.Bottom + FPadding);
            aCanvas.MoveTo(aDrawRect.Left + FLeftTopRect.Right + FPadding, aDrawRect.Top);
            aCanvas.LineTo(aDrawRect.Left + FLeftTopRect.Right + FPadding, aDrawRect.Bottom);

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

                if (FActiveArea != ToothArea.ctaNone)
                {
                    switch (FActiveArea)
                    {
                    case ToothArea.ctaLeftTop:
                        vFocusRect = FLeftTopRect;
                        break;

                    case ToothArea.ctaLeftBottom:
                        vFocusRect = FLeftBottomRect;
                        break;

                    case ToothArea.ctaRightTop:
                        vFocusRect = FRightTopRect;
                        break;

                    case ToothArea.ctaRightBottom:
                        vFocusRect = FRightBottomRect;
                        break;
                    }

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

                if ((FMouseMoveArea != ToothArea.ctaNone) && (FMouseMoveArea != FActiveArea))
                {
                    switch (FMouseMoveArea)
                    {
                    case ToothArea.ctaLeftTop:
                        vFocusRect = FLeftTopRect;
                        break;

                    case ToothArea.ctaLeftBottom:
                        vFocusRect = FLeftBottomRect;
                        break;

                    case ToothArea.ctaRightTop:
                        vFocusRect = FRightTopRect;
                        break;

                    case ToothArea.ctaRightBottom:
                        vFocusRect = FRightBottomRect;
                        break;
                    }

                    vFocusRect.Offset(aDrawRect.Left, aDrawRect.Top);
                    vFocusRect.Inflate(2, 2);
                    aCanvas.Pen.Color = Color.LightGray;
                    aCanvas.Rectangle(vFocusRect);
                }
            }
        }
コード例 #11
0
        /// <summary> 文档某节的Item绘制完成 </summary>
        /// <param name="AData">当前绘制的Data</param>
        /// <param name="ADrawItemIndex">Item对应的DrawItem序号</param>
        /// <param name="ADrawRect">Item对应的绘制区域</param>
        /// <param name="ADataDrawLeft">Data绘制时的Left</param>
        /// <param name="ADataDrawBottom">Data绘制时的Bottom</param>
        /// <param name="ADataScreenTop">绘制时呈现Data的Top位置</param>
        /// <param name="ADataScreenBottom">绘制时呈现Data的Bottom位置</param>
        /// <param name="ACanvas">画布</param>
        /// <param name="APaintInfo">绘制时的其它信息</param>
        protected override void DoSectionDrawItemPaintAfter(Object sender, HCCustomData aData, int aDrawItemNo, RECT aDrawRect,
                                                            int aDataDrawLeft, int aDataDrawBottom, int aDataScreenTop, int aDataScreenBottom, HCCanvas aCanvas, PaintInfo aPaintInfo)
        {
            if (FTraceCount > 0)  // 显示批注
            {
                HCCustomItem vItem = aData.Items[aData.DrawItems[aDrawItemNo].ItemNo];
                if (vItem.StyleNo > HCStyle.Null)
                {
                    DeItem vDeItem = vItem as DeItem;
                    if (vDeItem.StyleEx != StyleExtra.cseNone)  // 添加批注
                    {
                        HCDrawAnnotateDynamic vDrawAnnotate = new HCDrawAnnotateDynamic();
                        vDrawAnnotate.DrawRect = aDrawRect;
                        vDrawAnnotate.Title    = vDeItem.GetHint();
                        vDrawAnnotate.Text     = aData.GetDrawItemText(aDrawItemNo);

                        this.AnnotatePre.AddDrawAnnotate(vDrawAnnotate);
                    }
                }
            }

            base.DoSectionDrawItemPaintAfter(sender, aData, aDrawItemNo, aDrawRect, aDataDrawLeft, aDataDrawBottom,
                                             aDataScreenTop, aDataScreenBottom, aCanvas, aPaintInfo);
        }
コード例 #12
0
        private void DoDeItemPaintBKG(object sender, HCCanvas aCanvas, RECT aDrawRect, PaintInfo aPaintInfo)
        {
            if (aPaintInfo.Print)
            {
                return;
            }

            DeItem vDeItem = sender as DeItem;

            if (!vDeItem.Selected())
            {
                if (vDeItem.IsElement)
                {
                    if (vDeItem.MouseIn || vDeItem.Active)
                    {
                        if (vDeItem.IsSelectPart || vDeItem.IsSelectComplate)
                        {
                        }
                        else
                        {
                            if (vDeItem[DeProp.Name] != vDeItem.Text)
                            {
                                aCanvas.Brush.Color = FDeDoneColor;
                            }
                            else  // 没填写过
                            {
                                aCanvas.Brush.Color = FDeUnDoneColor;
                            }

                            aCanvas.FillRect(aDrawRect);
                        }
                    }
                    else  // 不是数据元
                    if (FDesignMode)
                    {
                        aCanvas.Brush.Color = HC.View.HC.clBtnFace;
                        aCanvas.FillRect(aDrawRect);
                    }
                }
                else  // 不是数据元
                if (FDesignMode && vDeItem.EditProtect)
                {
                    aCanvas.Brush.Color = HC.View.HC.clBtnFace;
                    aCanvas.FillRect(aDrawRect);
                }
            }

            if (!FHideTrace)                              // 显示痕迹
            {
                if (vDeItem.StyleEx == StyleExtra.cseDel) // 痕迹
                {
                    int vTextHeight = Style.TextStyles[vDeItem.StyleNo].FontHeight;
                    int vAlignVert  = User.DT_BOTTOM;
                    switch (Style.ParaStyles[vDeItem.ParaNo].AlignVert)
                    {
                    case ParaAlignVert.pavCenter:
                        vAlignVert = User.DT_CENTER;
                        break;

                    case ParaAlignVert.pavTop:
                        vAlignVert = User.DT_TOP;
                        break;

                    default:
                        vAlignVert = User.DT_BOTTOM;
                        break;
                    }

                    int vTop = aDrawRect.Top;
                    switch (vAlignVert)
                    {
                    case User.DT_TOP:
                        vTop = aDrawRect.Top;
                        break;

                    case User.DT_CENTER:
                        vTop = aDrawRect.Top + (aDrawRect.Bottom - aDrawRect.Top - vTextHeight) / 2;
                        break;

                    default:
                        vTop = aDrawRect.Bottom - vTextHeight;
                        break;
                    }

                    // 绘制删除线
                    aCanvas.Pen.BeginUpdate();
                    try
                    {
                        aCanvas.Pen.Style = HCPenStyle.psSolid;
                        aCanvas.Pen.Color = Color.Red;
                    }
                    finally
                    {
                        aCanvas.Pen.EndUpdate();
                    }

                    vTop = vTop + (aDrawRect.Bottom - vTop) / 2;
                    aCanvas.MoveTo(aDrawRect.Left, vTop - 1);
                    aCanvas.LineTo(aDrawRect.Right, vTop - 1);
                    aCanvas.MoveTo(aDrawRect.Left, vTop + 2);
                    aCanvas.LineTo(aDrawRect.Right, vTop + 2);
                }
                else
                if (vDeItem.StyleEx == StyleExtra.cseAdd)
                {
                    aCanvas.Pen.BeginUpdate();
                    try
                    {
                        aCanvas.Pen.Style = HCPenStyle.psSolid;
                        aCanvas.Pen.Color = Color.Blue;
                    }
                    finally
                    {
                        aCanvas.Pen.EndUpdate();
                    }

                    aCanvas.MoveTo(aDrawRect.Left, aDrawRect.Bottom);
                    aCanvas.LineTo(aDrawRect.Right, aDrawRect.Bottom);
                }
            }
        }
コード例 #13
0
        /// <summary> 文档某节的Item绘制完成 </summary>
        /// <param name="AData">当前绘制的Data</param>
        /// <param name="ADrawItemIndex">Item对应的DrawItem序号</param>
        /// <param name="ADrawRect">Item对应的绘制区域</param>
        /// <param name="ADataDrawLeft">Data绘制时的Left</param>
        /// <param name="ADataDrawBottom">Data绘制时的Bottom</param>
        /// <param name="ADataScreenTop">绘制时呈现Data的Top位置</param>
        /// <param name="ADataScreenBottom">绘制时呈现Data的Bottom位置</param>
        /// <param name="ACanvas">画布</param>
        /// <param name="APaintInfo">绘制时的其它信息</param>
        protected override void DoSectionDrawItemPaintAfter(Object sender, HCCustomData aData, int aItemNo, int aDrawItemNo, RECT aDrawRect,
                                                            int aDataDrawLeft, int aDataDrawRight, int aDataDrawBottom, int aDataScreenTop, int aDataScreenBottom, HCCanvas aCanvas, PaintInfo aPaintInfo)
        {
            if ((!FHideTrace) && (FTraceCount > 0))  // 显示痕迹且有痕迹
            {
                HCCustomItem vItem = aData.Items[aItemNo];
                if (vItem.StyleNo > HCStyle.Null)
                {
                    DeItem vDeItem = vItem as DeItem;
                    if (vDeItem.StyleEx != StyleExtra.cseNone)  // 添加批注
                    {
                        HCDrawAnnotateDynamic vDrawAnnotate = new HCDrawAnnotateDynamic();
                        vDrawAnnotate.DrawRect = aDrawRect;
                        vDrawAnnotate.Title    = vDeItem.GetHint();
                        vDrawAnnotate.Text     = aData.GetDrawItemText(aDrawItemNo);

                        this.AnnotatePre.AddDrawAnnotate(vDrawAnnotate);
                    }
                }
            }

            if ((FPageBlankTip != "") && (aData is HCPageData))
            {
                if (aDrawItemNo < aData.DrawItems.Count - 1)
                {
                    if (aData.Items[aData.DrawItems[aDrawItemNo + 1].ItemNo].PageBreak)
                    {
                        DrawBlankTip_(aDataDrawLeft, aDrawRect.Top + aDrawRect.Height + aData.GetLineBlankSpace(aDrawItemNo), aDataDrawRight, aDataDrawBottom, aCanvas);
                    }
                }
                else
                {
                    DrawBlankTip_(aDataDrawLeft, aDrawRect.Top + aDrawRect.Height + aData.GetLineBlankSpace(aDrawItemNo), aDataDrawRight, aDataDrawBottom, aCanvas);
                }
            }

            base.DoSectionDrawItemPaintAfter(sender, aData, aItemNo, aDrawItemNo, aDrawRect, aDataDrawLeft, aDataDrawRight,
                                             aDataDrawBottom, aDataScreenTop, aDataScreenBottom, aCanvas, aPaintInfo);
        }
コード例 #14
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);
 }
コード例 #15
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.Empty) && this.Active && (!aPaintInfo.Print))  // 非打印状态下的空白图片
     {
         aCanvas.Font.Size = 12;
         aCanvas.Font.FontStyles.InClude((byte)HCFontStyle.tsItalic);
         aCanvas.TextOut(aDrawRect.Left + 2, aDrawRect.Top + 2, "DeIndex:" + this[DeProp.Index]);
     }
 }
コード例 #16
0
        private void DoDeItemPaintBKG(object sender, HCCanvas aCanvas, RECT aDrawRect, PaintInfo aPaintInfo)
        {
            if (!aPaintInfo.Print)
            {
                DeItem vDeItem = sender as DeItem;
                if (vDeItem.IsElement)
                {
                    if ((vDeItem.MouseIn) || (vDeItem.Active))
                    {
                        if ((vDeItem.IsSelectPart) || (vDeItem.IsSelectComplate))
                        {
                        }
                        else
                        {
                            if (vDeItem[DeProp.Name] != vDeItem.Text)
                            {
                                aCanvas.Brush.Color = FDeDoneColor;
                            }
                            else
                            {
                                aCanvas.Brush.Color = FDeUnDoneColor;
                            }

                            aCanvas.FillRect(aDrawRect);
                        }
                    }
                }
                else
                {
                    if (FDesignMode && vDeItem.EditProtect)
                    {
                        aCanvas.Brush.Color = HC.View.HC.clBtnFace;
                        aCanvas.FillRect(aDrawRect);
                    }
                }
            }
        }
コード例 #17
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 (FOnPaintBKG != null)
            {
                FOnPaintBKG(this, aCanvas, aDrawRect, aPaintInfo);
            }

            if (FStyleEx == StyleExtra.cseDel)
            {
                int vTextHeight = aStyle.TextStyles[this.StyleNo].FontHeight;
                int vAlignVert  = User.DT_BOTTOM;
                switch (aStyle.ParaStyles[this.ParaNo].AlignVert)
                {
                case ParaAlignVert.pavCenter:
                    vAlignVert = User.DT_CENTER;
                    break;

                case ParaAlignVert.pavTop:
                    vAlignVert = User.DT_TOP;
                    break;

                default:
                    vAlignVert = User.DT_BOTTOM;
                    break;
                }

                int vTop = aDrawRect.Top;
                switch (vAlignVert)
                {
                case User.DT_TOP:
                    vTop = aDrawRect.Top;
                    break;

                case User.DT_CENTER:
                    vTop = aDrawRect.Top + (aDrawRect.Bottom - aDrawRect.Top - vTextHeight) / 2;
                    break;

                default:
                    vTop = aDrawRect.Bottom - vTextHeight;
                    break;
                }

                // 绘制删除线
                aCanvas.Pen.BeginUpdate();
                try
                {
                    aCanvas.Pen.Style = HCPenStyle.psSolid;
                    aCanvas.Pen.Color = Color.Red;
                }
                finally
                {
                    aCanvas.Pen.EndUpdate();
                }

                vTop = vTop + (aDrawRect.Bottom - vTop) / 2;
                aCanvas.MoveTo(aDrawRect.Left, vTop - 1);
                aCanvas.LineTo(aDrawRect.Right, vTop - 1);
                aCanvas.MoveTo(aDrawRect.Left, vTop + 2);
                aCanvas.LineTo(aDrawRect.Right, vTop + 2);
            }
            else
            if (FStyleEx == StyleExtra.cseAdd)
            {
                aCanvas.Pen.BeginUpdate();
                try
                {
                    aCanvas.Pen.Style = HCPenStyle.psSolid;
                    aCanvas.Pen.Color = Color.Blue;
                }
                finally
                {
                    aCanvas.Pen.EndUpdate();
                }

                aCanvas.MoveTo(aDrawRect.Left, aDrawRect.Bottom);
                aCanvas.LineTo(aDrawRect.Right, aDrawRect.Bottom);
            }
        }