Example #1
0
 public override void DrawButton(
     int x, int y,
     int width, int height,
     FontInfo fontInfo,
     int fontHeight,
     BasicColor borderColor,
     BasicColor fillColor,
     BasicColor fontColor,
     string text,
     Canvas.RoundedCornerStyle cornerStyle = RoundedCornerStyle.All)
 {
     BasicTypeSerializer.Put(Context,(byte)Command.DrawButton);
     BasicTypeSerializer.Put(Context,(ushort)x);
     BasicTypeSerializer.Put(Context,(ushort)y);
     BasicTypeSerializer.Put(Context,(ushort)width);
     BasicTypeSerializer.Put(Context,(ushort)height);
     BasicTypeSerializer.Put(Context,fontInfo.ID);
     BasicTypeSerializer.Put(Context,(ushort)fontHeight);
     BasicTypeSerializer.Put(Context,(ushort)borderColor);
     BasicTypeSerializer.Put(Context,(ushort)fillColor);
     BasicTypeSerializer.Put(Context,(ushort)fontColor);
     BasicTypeSerializer.Put(Context,text, true);
     BasicTypeSerializer.Put(Context,(ushort)cornerStyle);
 }
Example #2
0
 public virtual void DrawButton(int x, int y, int width, int height, FontInfo fontInfo, int fontHeight, BasicColor borderColor, BasicColor fillColor, BasicColor fontColor, string text, Canvas.RoundedCornerStyle cornerStyle = RoundedCornerStyle.All)
 {
     // Border
     DrawRectangleRounded(x, y, x + width, y + height, borderColor, 5, cornerStyle);
     // Fill
     DrawRectangleRounded(x + 2, y + 2, x + width - 2, y + height - 2, fillColor, 5, cornerStyle);
     // Render text
     if (text.Length != 0) {
         var textWidth = GetStringWidth(fontInfo, text);
         var xStart = x + (width / 2) - (textWidth / 2);
         var yStart = y + (height / 2) - (fontHeight / 2) + 1;
         DrawString(xStart, yStart, fontColor, fontInfo, text);
     }
 }