c Graphics USES the method of to draw circles to write code
- 2020-05-30 20:58:12
- OfStack
Draw a filling circle:
Graphics gra = this.pictureBox1.CreateGraphics();
gra.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
Brush bush = new SolidBrush(Color.Green);// Fill color
gra.FillEllipse(bush, 10, 10, 100, 100);// Draw the way to fill the ellipse, x Coordinates, y Coordinates, width, height, if yes 100 , then the radius is 50
Draw a circle:
Graphics gra = this.pictureBox1.CreateGraphics();
gra.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
Pen pen = new Pen(Color.Pink);// The brush color
gra.DrawEllipse(pen, 250, 10, 100, 100);// The way to draw an ellipse, x Coordinates, y Coordinates, width, height, if yes 100 , then the radius is 50
Writing:
Graphics gra = this.pictureBox1.CreateGraphics();
Font myFont = new Font(" Song typeface ", 60, FontStyle.Bold);
Brush bush = new SolidBrush(Color.Red);// Fill color
gra.DrawString(" Script house! ", myFont, bush, 100, 100);