FillRectangle() public abstract method

public abstract FillRectangle ( Brush brush, float left, float top, float width, float height ) : void
brush Brush
left float
top float
width float
height float
return void
        protected override void DrawBoxContent(Canvas canvas, Rectangle updateArea)
        {
            var enterFont = canvas.CurrentFont;
            canvas.CurrentFont = this.CurrentTextSpanStyle.FontInfo;
            if (vscrollableSurface != null)
            {
                vscrollableSurface.DrawToThisPage(canvas, updateArea);
            }
            //1. bg 
            if (BackgroundColor.A > 0)
            {
                //canvas.FillRectangle(BackgroundColor, 0, 0, updateArea.Width, updateArea.Height);
                canvas.FillRectangle(BackgroundColor, 0, 0, this.Width, this.Height);
            }


            //2. sub ground 
            if (internalTextLayerController.SelectionRange != null)
            {
                internalTextLayerController.SelectionRange.Draw(canvas, updateArea);
            }

            //3. each layer
            if (vscrollableSurface != null)
            {
                vscrollableSurface.DrawToThisPage(canvas, updateArea);
            }
            else
            {
                this.textLayer.DrawChildContent(canvas, updateArea);
                if (this.HasDefaultLayer)
                {
                    this.DrawDefaultLayer(canvas, ref updateArea);
                }
            }

#if DEBUG
            //for debug
            canvas.FillRectangle(Color.Red, 0, 0, 5, 5);
#endif  
            //4. caret 
            if (this.stateShowCaret)
            {
                Point textManCaretPos = internalTextLayerController.CaretPos;
                this.myCaret.DrawCaret(canvas, textManCaretPos.X, textManCaretPos.Y);
            }
            else
            {
            }
            canvas.CurrentFont = enterFont;
        }
        protected override void DrawBoxContent(Canvas canvas, Rectangle updateArea)
        {
#if DEBUG
            if (this.dbugBreak)
            {
            }
#endif
            //sample bg   
            //canvas.FillRectangle(BackColor, updateArea.Left, updateArea.Top, updateArea.Width, updateArea.Height);
            canvas.FillRectangle(BackColor, 0, 0, this.Width, this.Height);
            this.DrawDefaultLayer(canvas, ref updateArea);
#if DEBUG
            //canvas.dbug_DrawCrossRect(PixelFarm.Drawing.Color.Black,
            //    new Rectangle(0, 0, this.Width, this.Height));

            //canvas.dbug_DrawCrossRect(PixelFarm.Drawing.Color.Black,
            //   new Rectangle(updateArea.Left, updateArea.Top, updateArea.Width, updateArea.Height));
#endif
        }
 protected override void DrawBoxContent(Canvas canvas, Rectangle updateArea)
 {
     canvas.FillRectangle(Color.White, 0, 0, this.Width, this.Height);
     this.DrawDefaultLayer(canvas, ref updateArea);
 }
 public void dbugShowRenderPart(Canvas canvasPage, Rectangle updateArea)
 {
     RootGraphic visualroot = this.dbugVRoot;
     if (visualroot.dbug_ShowRootUpdateArea)
     {
         canvasPage.FillRectangle(Color.FromArgb(50, Color.Black),
              updateArea.Left, updateArea.Top,
                 updateArea.Width - 1, updateArea.Height - 1);
         canvasPage.FillRectangle(Color.White,
              updateArea.Left, updateArea.Top, 5, 5);
         canvasPage.DrawRectangle(Color.Yellow,
                 updateArea.Left, updateArea.Top,
                 updateArea.Width - 1, updateArea.Height - 1);
         Color c_color = canvasPage.CurrentTextColor;
         canvasPage.CurrentTextColor = Color.White;
         canvasPage.DrawText(visualroot.dbug_RootUpdateCounter.ToString().ToCharArray(), updateArea.Left, updateArea.Top);
         if (updateArea.Height > 25)
         {
             canvasPage.DrawText(visualroot.dbug_RootUpdateCounter.ToString().ToCharArray(), updateArea.Left, updateArea.Top + (updateArea.Height - 20));
         }
         canvasPage.CurrentTextColor = c_color;
         visualroot.dbug_RootUpdateCounter++;
     }
 }
 public void Draw(Canvas destPage, Rectangle updateArea)
 {
     if (IsOnTheSameLine)
     {
         VisualPointInfo topEndPoint = TopEnd;
         VisualPointInfo bottomEndPoint = BottomEnd;
         int linetop = topEndPoint.LineTop;
         destPage.FillRectangle(Color.LightGray, topEndPoint.X, linetop,
             bottomEndPoint.X - topEndPoint.X, topEndPoint.ActualLineHeight);
     }
     else
     {
         EditableVisualPointInfo topEndPoint = TopEnd;
         int lineYPos = topEndPoint.LineTop;
         destPage.FillRectangle(Color.LightGray, topEndPoint.X, lineYPos,
             topEndPoint.CurrentWidth - topEndPoint.X,
             topEndPoint.ActualLineHeight);
         int topLineId = topEndPoint.LineId;
         int bottomLineId = BottomEnd.LineId;
         if (bottomLineId - topLineId > 1)
         {
             EditableTextLine adjacentStartLine = topEndPoint.EditableLine.Next;
             while (adjacentStartLine != BottomEnd.Line)
             {
                 destPage.FillRectangle(Color.LightGray, 0,
                     adjacentStartLine.LineTop,
                     adjacentStartLine.CurrentWidth,
                     adjacentStartLine.ActualLineHeight);
                 adjacentStartLine = adjacentStartLine.Next;
             }
             EditableTextLine adjacentStopLine = BottomEnd.Line.Prev;
         }
         VisualPointInfo bottomEndPoint = BottomEnd;
         lineYPos = bottomEndPoint.LineTop;
         destPage.FillRectangle(Color.LightGray, 0, lineYPos, bottomEndPoint.X,
              bottomEndPoint.ActualLineHeight);
     }
 }
 internal void DrawCaret(Canvas canvas, int x, int y)
 {
     canvas.FillRectangle(Color.Black, x, y, this.Width, this.Height);
 }
Beispiel #7
0
 public override void CustomDrawToThisCanvas(Canvas canvas, Rectangle updateArea)
 {
     int bWidth = this.Width;
     int bHeight = this.Height;
     canvas.FillRectangle(Color.Yellow, updateArea.Left, updateArea.Top, updateArea.Width, updateArea.Height);
     if (!this.HasStyle)
     {
         canvas.DrawText(this.mybuffer, new Rectangle(0, 0, bWidth, bHeight), 0);
     }
     else
     {
         TextSpanStyle style = this.SpanStyle;
         switch (EvaluateFontAndTextColor(canvas, style))
         {
             case DIFF_FONT_SAME_TEXT_COLOR:
                 {
                     var prevFont = canvas.CurrentFont;
                     canvas.CurrentFont = style.FontInfo;
                     canvas.DrawText(this.mybuffer,
                        new Rectangle(0, 0, bWidth, bHeight),
                        style.ContentHAlign);
                     canvas.CurrentFont = prevFont;
                 }
                 break;
             case DIFF_FONT_DIFF_TEXT_COLOR:
                 {
                     var prevFont = canvas.CurrentFont;
                     var prevColor = canvas.CurrentTextColor;
                     canvas.CurrentFont = style.FontInfo;
                     canvas.CurrentTextColor = style.FontColor;
                     canvas.DrawText(this.mybuffer,
                        new Rectangle(0, 0, bWidth, bHeight),
                        style.ContentHAlign);
                     canvas.CurrentFont = prevFont;
                     canvas.CurrentTextColor = prevColor;
                 }
                 break;
             case SAME_FONT_DIFF_TEXT_COLOR:
                 {
                     var prevColor = canvas.CurrentTextColor;
                     canvas.DrawText(this.mybuffer,
                     new Rectangle(0, 0, bWidth, bHeight),
                     style.ContentHAlign);
                     canvas.CurrentTextColor = prevColor;
                 }
                 break;
             default:
                 {
                     canvas.DrawText(this.mybuffer,
                        new Rectangle(0, 0, bWidth, bHeight),
                        style.ContentHAlign);
                 }
                 break;
         }
     }
 }