// ハッチブラシ
private void picBoxHatch_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
this.picBoxForHatchBrush.Width = this.tabHatchBrush.ClientSize.Width;
Graphics g = e.Graphics;
int x = 0;
int y = 10;
string [] hatchStyleNames = Enum.GetNames(typeof(HatchStyle));
foreach(string hatchStyleStr in hatchStyleNames)
{
HatchStyle hatchStyle = (HatchStyle)Enum.Parse(typeof(HatchStyle), hatchStyleStr);
HatchBrush hb = new HatchBrush(hatchStyle, Color.Blue,
Color.FromArgb(100, Color.Cyan));
g.DrawString(hatchStyle.ToString(), this.Font, new SolidBrush(Color.Black), x + 10, y);
g.FillEllipse(hb, x + 10, y + 10, 100, 20);
x += 150;
if ( x + 100 >= this.picBoxForHatchBrush.Width)
{
x = 0;
y += 40;
}
}
this.picBoxForHatchBrush.Height = y + 50;
}
|