2009年5月17日日曜日1:03:00
久しぶりのプログラミング
背景にも描画してみる。きちんと、背景に描画されるわけじゃないのね。描画された順か。
private void button1_Click(object sender, EventArgs e)
{
Pen pen1 = new Pen(Color.Black);
Brush brush1 = new SolidBrush(Color.Red);
Graphics g1 = Graphics.FromImage(pictureBox1.Image);
g1.FillEllipse(brush1, 15, 15, 100, 150);
g1.DrawEllipse(pen1, 10, 10, 140, 150);
g1.DrawEllipse(pen1, 10, 20, 200, 200);
Pen pen2 = new Pen(Color.Magenta, 5);
Brush brush2 = new SolidBrush(Color.Chocolate);
Graphics g2 = Graphics.FromImage(pictureBox1.BackgroundImage);
g2.FillEllipse(brush2, 10, 10, 300, 300);
g2.DrawEllipse(pen2, 0, 0, 150, 130);
g2.DrawLine(pen2, 0, 0, 200, 200);
pictureBox1.Refresh();
}
先に描画しておけば、問題なしですな

0 件のコメント:
コメントを投稿