本文整理汇总了C#中Eto.Drawing.RectangleF.Inflate方法的典型用法代码示例。如果您正苦于以下问题:C# RectangleF.Inflate方法的具体用法?C# RectangleF.Inflate怎么用?C# RectangleF.Inflate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Eto.Drawing.RectangleF
的用法示例。
在下文中一共展示了RectangleF.Inflate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Draw
public static void Draw(Graphics graphics)
{
var generator = graphics.Generator;
var image = TestIcons.TestImage(generator);
// lines
var whitePen = Pens.White(generator);
graphics.DrawLine(whitePen, 1, 1, 99, 99);
graphics.DrawLine(whitePen, 50, 1, 50, 99);
graphics.DrawLine(whitePen, 1, 51, 99, 51);
graphics.DrawRectangle(Pens.White(generator), 101, 1, 100, 100);
graphics.DrawRectangle(Pens.White(generator), 101, 1, 10, 10);
graphics.DrawEllipse(Pens.Green(generator), 101, 1, 100, 100);
graphics.DrawPolygon(Pens.White(generator), new PointF(203, 1), new PointF(253, 51), new Point(203, 101), new PointF(203, 1), new PointF(253, 1), new PointF(253, 101), new PointF(203, 101));
var rect = new RectangleF(255, 1, 100, 100);
graphics.DrawArc(Pens.LightGreen(generator), rect, 180, 90);
graphics.DrawArc(Pens.SkyBlue(generator), rect, 0, 90);
rect.Inflate(-15, 0);
graphics.DrawArc(Pens.FloralWhite(generator), rect, -45, 90);
rect.Inflate(-5, -20);
graphics.DrawArc(Pens.SlateGray(generator), rect, -45, 270);
rect.Inflate(-10, -10);
graphics.DrawArc(Pens.SteelBlue(generator), rect, 180 + 45, 270);
graphics.DrawImage(image, 100, 1, 100, 100);
graphics.DrawText(Fonts.Sans(12 * graphics.PointsPerPixel, generator: generator), Colors.White, 0, 104, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
// filled
graphics.FillRectangle(Brushes.White(generator), 101, 120, 100, 100);
graphics.FillRectangle(Brushes.Gray(generator), 101, 120, 10, 10);
graphics.FillEllipse(Brushes.Green(generator), 101, 120, 100, 100);
graphics.FillPolygon(Brushes.White(generator), new PointF(202, 120), new PointF(252, 170), new Point(202, 220), new PointF(202, 120));
rect = new RectangleF(255, 120, 100, 100);
graphics.FillPie(Brushes.LightGreen(generator), rect, 180, 90);
graphics.FillPie(Brushes.SkyBlue(generator), rect, 0, 90);
rect.Inflate(-15, 0);
graphics.FillPie(Brushes.FloralWhite(generator), rect, -45, 90);
rect.Inflate(-5, -20);
graphics.FillPie(Brushes.SlateGray(generator), rect, -45, 270);
rect.Inflate(-10, -10);
graphics.FillPie(Brushes.SteelBlue(generator), rect, 180 + 45, 270);
graphics.DrawImage(image, 101, 120, 100, 100);
}
示例2: Draw
public static void Draw(Graphics graphics)
{
var image = TestIcons.TestImage;
// lines
var whitePen = new Pen(Colors.White, 1);
graphics.DrawLine(whitePen, 1, 1, 99, 99);
graphics.DrawLine(whitePen, 50, 1, 50, 99);
graphics.DrawLine(whitePen, 1, 51, 99, 51);
graphics.DrawRectangle(whitePen, 101, 1, 100, 100);
graphics.DrawRectangle(whitePen, 101, 1, 10, 10);
graphics.DrawEllipse(Pens.Green, 101, 1, 100, 100);
graphics.DrawPolygon(whitePen, new PointF(203, 1), new PointF(253, 51), new Point(203, 101), new PointF(203, 1), new PointF(253, 1), new PointF(253, 101), new PointF(203, 101));
var rect = new RectangleF(255, 1, 100, 100);
graphics.DrawArc(Pens.LightGreen, rect, 180, 90);
graphics.DrawArc(Pens.SkyBlue, rect, 0, 90);
rect.Inflate(-15, 0);
graphics.DrawArc(Pens.FloralWhite, rect, -45, 90);
rect.Inflate(-5, -20);
graphics.DrawArc(Pens.SlateGray, rect, -45, 270);
rect.Inflate(-10, -10);
graphics.DrawArc(Pens.SteelBlue, rect, 180 + 45, 270);
graphics.DrawImage(image, 100, 1, 100, 100);
graphics.DrawText(Fonts.Sans(12 * graphics.PointsPerPixel), Colors.White, 0, 104, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
// filled
graphics.FillRectangle(Brushes.White, 101, 120, 100, 100);
graphics.FillRectangle(Brushes.Gray, 101, 120, 10, 10);
graphics.FillEllipse(Brushes.Green, 101, 120, 100, 100);
graphics.FillPolygon(Brushes.White, new PointF(202, 120), new PointF(252, 170), new Point(202, 220), new PointF(202, 120));
rect = new RectangleF(255, 120, 100, 100);
graphics.FillPie(Brushes.LightGreen, rect, 180, 90);
graphics.FillPie(Brushes.SkyBlue, rect, 0, 90);
rect.Inflate(-15, 0);
graphics.FillPie(Brushes.FloralWhite, rect, -45, 90);
rect.Inflate(-5, -20);
graphics.FillPie(Brushes.SlateGray, rect, -45, 270);
rect.Inflate(-10, -10);
graphics.FillPie(Brushes.SteelBlue, rect, 180 + 45, 270);
graphics.DrawImage(image, 101, 120, 100, 100);
const int offset = 440;
var xoffset = offset;
var yoffset = 112;
for (int i = 1; i < 14; i++)
{
var pen = new Pen(Colors.White, i);
pen.LineCap = PenLineCap.Butt;
graphics.DrawLine(pen, xoffset, 1, xoffset, 110);
graphics.DrawLine(pen, offset, yoffset, offset + 100, yoffset);
xoffset += i + 2;
yoffset += i + 2;
}
}
示例3: DrawInsetRectangle
/// <summary>
/// Draws an rectangle with colors on the top/left and bottom/right with the given <paramref name="width"/>
/// </summary>
/// <param name="topLeftColor">Color for top/left edges</param>
/// <param name="bottomRightColor">Color for bottom/right edges</param>
/// <param name="rectangle">Outside of inset rectangle to draw</param>
/// <param name="width">Width of the rectangle, in pixels</param>
public void DrawInsetRectangle (Color topLeftColor, Color bottomRightColor, RectangleF rectangle, int width = 1)
{
using (var topLeftPen = new Pen(topLeftColor, 1f, Generator))
using (var bottomRightPen = new Pen(bottomRightColor, 1f, Generator))
for (int i = 0; i < width; i++) {
DrawLine (topLeftPen, rectangle.TopLeft, rectangle.InnerTopRight);
DrawLine (topLeftPen, rectangle.TopLeft, rectangle.InnerBottomLeft);
DrawLine (bottomRightPen, rectangle.InnerBottomLeft, rectangle.InnerBottomRight);
DrawLine (bottomRightPen, rectangle.InnerTopRight, rectangle.InnerBottomRight);
rectangle.Inflate (-1, -1);
}
}