本文整理汇总了C#中System.Drawing.Graphics.FillEllipse方法的典型用法代码示例。如果您正苦于以下问题:C# Graphics.FillEllipse方法的具体用法?C# Graphics.FillEllipse怎么用?C# Graphics.FillEllipse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.Graphics
的用法示例。
在下文中一共展示了Graphics.FillEllipse方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FillEllipseInt
public void FillEllipseInt(PaintEventArgs e)
{
// Create solid brush.
SolidBrush redBrush = new SolidBrush(Color.Red);
// Create location and size of ellipse.
int x = 0;
int y = 0;
int width = 200;
int height = 100;
// Fill ellipse on screen.
e.Graphics.FillEllipse(redBrush, x, y, width, height);
}
示例2: FillEllipseFloat
public void FillEllipseFloat(PaintEventArgs e)
{
// Create solid brush.
SolidBrush redBrush = new SolidBrush(Color.Red);
// Create location and size of ellipse.
float x = 0.0F;
float y = 0.0F;
float width = 200.0F;
float height = 100.0F;
// Fill ellipse on screen.
e.Graphics.FillEllipse(redBrush, x, y, width, height);
}
示例3: FillEllipseRectangle
public void FillEllipseRectangle(PaintEventArgs e)
{
// Create solid brush.
SolidBrush redBrush = new SolidBrush(Color.Red);
// Create rectangle for ellipse.
int x = 0;
int y = 0;
int width = 200;
int height = 100;
Rectangle rect = new Rectangle(x, y, width, height);
// Fill ellipse on screen.
e.Graphics.FillEllipse(redBrush, rect);
}
示例4: Main
//引入命名空间
using System;
using System.Drawing;
using System.Windows.Forms;
class FourByFours: Form
{
public static void Main()
{
Application.Run(new FourByFours());
}
public FourByFours()
{
Text = "Four by Fours";
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)
{
Pen pen = new Pen(clr);
Brush brush = new SolidBrush(clr);
grfx.FillEllipse(brush, new Rectangle(14, 8, 4, 4));
}
}
示例5: FillEllipseRectangleF
public void FillEllipseRectangleF(PaintEventArgs e)
{
// Create solid brush.
SolidBrush redBrush = new SolidBrush(Color.Red);
// Create rectangle for ellipse.
float x = 0.0F;
float y = 0.0F;
float width = 200.0F;
float height = 100.0F;
RectangleF rect = new RectangleF(x, y, width, height);
// Fill ellipse on screen.
e.Graphics.FillEllipse(redBrush, rect);
}
示例6: Graphics.FillEllipse(Brush brush,int x, int y,int width,int height)
//引入命名空间
using System;
using System.Drawing;
using System.Windows.Forms;
public class Test : Form {
private RadioButton square = new RadioButton();
private RadioButton circle = new RadioButton();
private ComboBox color = new ComboBox();
private Color c = Color.Red;
public Test( ) {
Text = "Select Item";
square.Text = "Square";
circle.Text = "Circle";
color.Text = "Choose a color";
Size = new Size(400,250);
int w = 20;
square.Location = new Point(w, 30);
circle.Location = new Point(w += 10 + square.Width, 30);
color.Location = new Point(w += 10 + circle.Width, 30);
color.Items.Add("Red");
color.Items.Add("Green");
color.Items.Add("Blue");
Controls.Add(square);
Controls.Add(circle);
Controls.Add(color);
square.CheckedChanged += new EventHandler(Checked_Changed);
circle.CheckedChanged += new EventHandler(Checked_Changed);
color.SelectedIndexChanged += new EventHandler(Selected_Index);
}
protected override void OnPaint(PaintEventArgs e){
Graphics g = e.Graphics;
Brush brush = new SolidBrush(c);
if (square.Checked)
g.FillRectangle(brush,100,100,100,100);
else
g.FillEllipse(brush,100,100,100,100);
base.OnPaint( e );
}
protected void Selected_Index(Object sender, EventArgs e){
if (color.SelectedItem.ToString() == "Red" )
c = Color.Red;
else if (color.SelectedItem.ToString() == "Green")
c = Color.Green;
else
c = Color.Blue;
Invalidate();
}
protected void Checked_Changed(Object sender, EventArgs e) {
Invalidate();
}
static void Main() {
Application.Run(new Test());
}
}