DrawText() public abstract method

public abstract DrawText ( char buffer, Rectangle logicalTextBox, int textAlignment ) : void
buffer char
logicalTextBox Rectangle
textAlignment int
return void
Exemplo n.º 1
0
 public override void CustomDrawToThisCanvas(Canvas canvas, Rectangle updateArea)
 {
     if (this.textBuffer != null)
     {
         var prevColor = canvas.CurrentTextColor;
         canvas.CurrentTextColor = textColor;
         canvas.DrawText(this.textBuffer, this.X, this.Y);
         canvas.CurrentTextColor = prevColor;
     }
 }
Exemplo n.º 2
0
 public override void CustomDrawToThisCanvas(Canvas canvas, Rectangle updateArea)
 {
     int bWidth = this.Width;
     int bHeight = this.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;
         }
     }
 }
 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++;
     }
 }
 void debug_RecordPostDrawInfo(Canvas canvasPage)
 {
     if (dbugVRoot.dbug_ShowElementOutline)
     {
         canvasPage.DrawRectangle(Color.Red,
             0, 0, this.Width - 1, this.Height - 1);
     }
     if (dbugVRoot.dbug_ForceShowObjectIden)
     {
         var prevColor = canvasPage.CurrentTextColor;
         canvasPage.CurrentTextColor = Color.Blue;
         canvasPage.DrawText(
                 ("<< " + dbug_FullElementDescription()).ToCharArray()
                 , 0, dbug_element_code_y);
         canvasPage.CurrentTextColor = prevColor;
     }
     else if (dbugVRoot.dbug_ShowObjectIden && !dbug_hide_objIden)
     {
         var prevColor = canvasPage.CurrentTextColor;
         canvasPage.CurrentTextColor = Color.Blue;
         canvasPage.DrawText(
                 ("<< " + dbug_FullElementDescription()).ToCharArray()
                 , 0, dbug_element_code_y);
         canvasPage.CurrentTextColor = prevColor;
     }
 }
Exemplo n.º 5
0
        public override void DrawChildContent(Canvas canvas, Rectangle updateArea)
        {
            //GridCell leftTopGridItem = GetGridItemByPosition(updateArea.Left, updateArea.Top);
            //if (leftTopGridItem == null)
            //{
            //    return;

            //}
            //GridCell rightBottomGridItem = GetGridItemByPosition(updateArea.Right, updateArea.Bottom);
            //if (rightBottomGridItem == null)
            //{
            //    return;
            //}


            //TODO: temp fixed, review here again,
            GridCell leftTopGridItem = this.GetCell(0, 0);
            if (leftTopGridItem == null)
            {
                return;
            }
            GridCell rightBottomGridItem = this.GetCell(this.RowCount - 1, this.ColumnCount - 1);
            if (rightBottomGridItem == null)
            {
                return;
            }
            this.BeginDrawingChildContent();
            GridColumn startColumn = leftTopGridItem.column;
            GridColumn currentColumn = startColumn;
            GridRow startRow = leftTopGridItem.row;
            GridColumn stopColumn = rightBottomGridItem.column.NextColumn;
            GridRow stopRow = rightBottomGridItem.row.NextRow;
            int startRowId = startRow.RowIndex;
            int stopRowId = 0;
            if (stopRow == null)
            {
                stopRowId = gridRows.Count;
            }
            else
            {
                stopRowId = stopRow.RowIndex;
            }
            int n = 0;
            var prevColor = canvas.StrokeColor;
            canvas.StrokeColor = Color.Gray;
            //canvas.DrawLine(0, 0, 100, 100);
            //canvas.DrawLine(0, 100, 100, 0);

            //if (startRowId > 0)
            //{
            //    Console.WriteLine(startRowId);
            //}

            //canvas.DrawRectangle(Color.Red, updateArea.Left, updateArea.Top, updateArea.Width, updateArea.Height);

            do
            {
                GridCell startGridItemInColumn = currentColumn.GetCell(startRowId);
                GridCell stopGridItemInColumn = currentColumn.GetCell(stopRowId - 1);
                //draw vertical line
                canvas.DrawLine(
                    startGridItemInColumn.Right,
                    startGridItemInColumn.Y,
                    stopGridItemInColumn.Right,
                    stopGridItemInColumn.Bottom);
                if (n == 0)
                {
                    //draw horizontal line
                    int horizontalLineWidth = rightBottomGridItem.Right - startGridItemInColumn.X;
                    for (int i = startRowId; i < stopRowId; i++)
                    {
                        GridCell gridItem = currentColumn.GetCell(i);
                        int x = gridItem.X;
                        int gBottom = gridItem.Bottom;
                        canvas.DrawLine(
                            x, gBottom,
                            x + horizontalLineWidth, gBottom);
                    }
                    n = 1;
                }
                currentColumn = currentColumn.NextColumn;
            } while (currentColumn != stopColumn);
            canvas.StrokeColor = prevColor;
            currentColumn = startColumn;
            //----------------------------------------------------------------------------
            do
            {
                for (int i = startRowId; i < stopRowId; i++)
                {
                    GridCell gridItem = currentColumn.GetCell(i);
                    if (gridItem != null && gridItem.HasContent)
                    {
                        int x = gridItem.X;
                        int y = gridItem.Y;
                        canvas.OffsetCanvasOrigin(x, y);
                        updateArea.Offset(-x, -y);
                        var renderContent = gridItem.ContentElement as RenderElement;
                        if (renderContent != null)
                        {
                            if (canvas.PushClipAreaRect(gridItem.Width, gridItem.Height, ref updateArea))
                            {
                                renderContent.DrawToThisCanvas(canvas, updateArea);
                            }
                            canvas.PopClipAreaRect();
                        }


                        canvas.OffsetCanvasOrigin(-x, -y);
                        updateArea.Offset(x, y);
                    }
#if DEBUG
                    else
                    {
                        canvas.DrawText(new char[] { '.' }, gridItem.X, gridItem.Y);
                    }
#endif
                }

                currentColumn = currentColumn.NextColumn;
            } while (currentColumn != stopColumn);
            this.FinishDrawingChildContent();
        }