Csharp/C Sharp by API/System.Drawing.Drawing2D/FillMode — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Версия 15:31, 26 мая 2010
FillMode.Alternate
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
class FillModesOddity : Form {
public static void Main() {
Application.Run(new FillModesOddity());
}
public FillModesOddity() {
Text = "Alternate and Winding Fill Modes (An Oddity)";
ClientSize = new Size(2 * ClientSize.Height, ClientSize.Height);
ResizeRedraw = true;
}
protected override void OnPaint(PaintEventArgs pea) {
DoPage(pea.Graphics, ForeColor, ClientSize.Width, ClientSize.Height);
}
protected void DoPage(Graphics grfx, Color clr, int cx, int cy) {
Brush brush = new SolidBrush(clr);
PointF[] aptf = { new PointF(100.1f, 400.7f), new PointF(400.5f, 10.7f),
new PointF(200.5f, 300.1f), new PointF(300.9f, 20.1f),
new PointF(300.9f, 200.5f), new PointF(300.3f, 390.5f),
new PointF(400.3f, 0.9f), new PointF(200.7f, 200.9f),
new PointF(500.7f, 100.3f), new PointF(100.1f, 400.3f)};
grfx.FillPolygon(brush, aptf, FillMode.Alternate);
}
}
FillMode.Winding
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
class FillModesOddity: Form
{
public static void Main()
{
Application.Run(new FillModesOddity());
}
public FillModesOddity()
{
Text = "Alternate and Winding Fill Modes (An Oddity)";
ClientSize = new Size(2 * ClientSize.Height, ClientSize.Height);
ResizeRedraw = true;
}
protected override void OnPaint(PaintEventArgs pea)
{
DoPage(pea.Graphics, ForeColor,ClientSize.Width, ClientSize.Height);
}
protected void DoPage(Graphics grfx, Color clr, int cx, int cy)
{
Brush brush = new SolidBrush(clr);
PointF[] aptf = { new PointF(100.1f, 400.7f), new PointF(400.5f, 10.7f),
new PointF(200.5f, 300.1f), new PointF(300.9f, 20.1f),
new PointF(300.9f, 200.5f), new PointF(300.3f, 390.5f),
new PointF(400.3f, 0.9f), new PointF(200.7f, 200.9f),
new PointF(500.7f, 100.3f), new PointF(100.1f, 400.3f)};
grfx.FillPolygon(brush, aptf, FillMode.Winding);
}
}