Hello,
I Want to draw a geometric object to the screen and then fill it. I can draw it, but don't come any further.
I have a button1_Click-Event:
- private void button1_Click(object sender, EventArgs e)
- {
- this.pictureBox1.Paint += new System.Windows.Forms.PaintEventHandler(this.FillEllipseRectangle);
- }
- private void FillEllipseRectangle(object sender, PaintEventArgs e)
- {
- MessageBox.Show("well done");
- ...
- }
I hope somebody can help me.
Dmitrij SolovPosted Nov 8, 2016, 2:59 PM
{
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
this.pictureBox1.Paint += new System.Windows.Forms.PaintEventHandler(this.FillEllipseRectangle);
}
private void FillEllipseRectangle(object sender, PaintEventArgs e)
{
MessageBox.Show("very well done!");
Pen itsme = new Pen(Color.Green, 3);
//Draw the ellipse
int x = 5;
int y = 5;
int width = 200;
int height = 100;
rect = new Rectangle(x, y, width, height);
e.Graphics.DrawEllipse(itsme, rect);
//Draw the ellipse
int x1= 5;
int y1 = 5;
int width1 = 200;
int height1 = 100;
rect1 = new Rectangle(x1, y1, width1, height1);
SolidBrush redBrush = new SolidBrush(Color.Red);
e.Graphics.FillEllipse(redBrush, this.rect1);
}
public System.Drawing.Rectangle rect { get; set; }
public System.Drawing.Rectangle rect1 { get; set; }
}
}
Bikesh SrivastavaPosted Nov 7, 2016, 10:53 PM
Dmitrij SolovPosted Nov 7, 2016, 12:05 PM
Amit GuptaPosted Nov 6, 2016, 1:45 PM
Dmitrij SolovPosted Nov 6, 2016, 1:33 PM
Amit GuptaPosted Nov 6, 2016, 1:24 PM
Dmitrij SolovPosted Nov 6, 2016, 1:17 PM
Amit GuptaPosted Nov 6, 2016, 12:55 PM