DrawRectangle() public abstract method

public abstract DrawRectangle ( Color color, float left, float top, float width, float height ) : void
color Color
left float
top float
width float
height float
return void
 protected override void DrawBoxContent(Canvas canvas, Rectangle updateArea)
 {
     //draw this ...
     var penwidth = canvas.StrokeWidth;
     int borderWidth = 5;
     int halfBorder = borderWidth / 2;
     canvas.StrokeWidth = borderWidth;
     canvas.DrawRectangle(
         Color.OrangeRed,
         halfBorder, halfBorder,
         this.Width - borderWidth,
         this.Height - borderWidth);
     canvas.StrokeWidth = penwidth;
 }
Beispiel #2
0
 /// <summary>
 /// Draw image failed to load icon.
 /// </summary>
 /// <param name="g">the device to draw into</param>
 /// <param name="r">the rectangle to draw icon in</param>
 public static void DrawImageErrorIcon(Canvas g, RectangleF r)
 {
     g.DrawRectangle(Color.LightGray, r.Left + 2, r.Top + 2, 15, 15);
     var image = GetErrorImage();
     g.DrawImage(image, new RectangleF(r.Left + 3, r.Top + 3, image.Width, image.Height));
 }
 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++;
     }
 }
Beispiel #4
0
        ///// <summary>
        ///// Get cached solid brush instance for the given color.
        ///// </summary>
        ///// <param name="color">the color to get brush for</param>
        ///// <returns>brush instance</returns>
        //public static Brush GetSolidBrush(Color color)
        //{

        //    if (color == Color.White)
        //    {
        //        return Brushes.White;
        //    }
        //    else if (color == Color.Black)
        //    {
        //        return Brushes.Black;
        //    }
        //    else if (!IsColorVisible(color))
        //    {
        //        return Brushes.Transparent;
        //    }
        //    else
        //    {
        //        Brush brush;
        //        if (!_brushesCache.TryGetValue(color, out brush))
        //        {

        //            _brushesCache[color] = brush = CurrentGraphicPlatform.CreateSolidBrush(color);

        //        }
        //        return brush;
        //    }
        //}

        ///// <summary>
        ///// Get cached pen instance for the given color.
        ///// </summary>
        ///// <param name="color">the color to get pen for</param>
        ///// <returns>pen instance</returns>
        //public static Pen GetPen(GraphicPlatform p, Color color)
        //{
        //    Pen pen;
        //    if (!_penCache.TryGetValue(color, out pen))
        //    {
        //        pen = p.CreateSolidPen(color); 
        //        _penCache[color] = pen;
        //    }
        //    else
        //    {
        //        pen.Width = 1;
        //    }
        //    return pen;
        //}
        /// <summary>
        /// Draw image loading icon.
        /// </summary>
        /// <param name="g">the device to draw into</param>
        /// <param name="r">the rectangle to draw icon in</param>
        public static void DrawImageLoadingIcon(Canvas g, RectangleF r)
        {
            g.DrawRectangle(Color.LightGray, r.Left + 3, r.Top + 3, 13, 14);
            var image = GetLoadImage();
            g.DrawImage(image, new RectangleF(r.Left + 4, r.Top + 4, image.Width, image.Height));
        }
 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;
     }
 }