Graphics.DrawEllipse 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
绘制由一对坐标、高度和宽度指定的边界矩形定义的椭圆。
重载
DrawEllipse(Pen, Int32, Int32, Int32, Int32) |
绘制由矩形左上角、高度和宽度的坐标指定的边界矩形定义的椭圆。 |
DrawEllipse(Pen, Single, Single, Single, Single) |
绘制由一对坐标、高度和宽度指定的边界矩形定义的椭圆。 |
DrawEllipse(Pen, RectangleF) |
绘制由边界 RectangleF定义的椭圆。 |
DrawEllipse(Pen, Rectangle) |
绘制由边界 Rectangle 结构指定的省略号。 |
DrawEllipse(Pen, Int32, Int32, Int32, Int32)
- Source:
- Graphics.cs
- Source:
- Graphics.cs
绘制由矩形左上角、高度和宽度的坐标指定的边界矩形定义的椭圆。
public:
void DrawEllipse(System::Drawing::Pen ^ pen, int x, int y, int width, int height);
public void DrawEllipse (System.Drawing.Pen pen, int x, int y, int width, int height);
member this.DrawEllipse : System.Drawing.Pen * int * int * int * int -> unit
Public Sub DrawEllipse (pen As Pen, x As Integer, y As Integer, width As Integer, height As Integer)
参数
- x
- Int32
定义椭圆的边框左上角的 x 坐标。
- y
- Int32
定义椭圆的边框左上角的 y 坐标。
- width
- Int32
定义椭圆的边界矩形的宽度。
- height
- Int32
定义椭圆的边界矩形的高度。
例外
pen
null
。
示例
下面的代码示例设计用于 Windows 窗体,它需要 PaintEventArgse
,这是 Paint 事件处理程序的参数。 该代码执行以下操作:
创建黑色笔。
创建矩形的位置和大小以绑定椭圆。
将椭圆绘制到屏幕。
private:
void DrawEllipseInt( PaintEventArgs^ e )
{
// Create pen.
Pen^ blackPen = gcnew Pen( Color::Black,3.0f );
// Create location and size of ellipse.
int x = 0;
int y = 0;
int width = 200;
int height = 100;
// Draw ellipse to screen.
e->Graphics->DrawEllipse( blackPen, x, y, width, height );
}
private void DrawEllipseInt(PaintEventArgs e)
{
// Create pen.
Pen blackPen = new Pen(Color.Black, 3);
// Create location and size of ellipse.
int x = 0;
int y = 0;
int width = 200;
int height = 100;
// Draw ellipse to screen.
e.Graphics.DrawEllipse(blackPen, x, y, width, height);
}
Private Sub DrawEllipseInt(ByVal e As PaintEventArgs)
' Create pen.
Dim blackPen As New Pen(Color.Black, 3)
' Create location and size of ellipse.
Dim x As Integer = 0
Dim y As Integer = 0
Dim width As Integer = 200
Dim height As Integer = 100
' Draw ellipse to screen.
e.Graphics.DrawEllipse(blackPen, x, y, width, height)
End Sub
注解
此方法绘制由 x
、y
、width
和 height
参数描述的边界矩形定义的省略号。
适用于
DrawEllipse(Pen, Single, Single, Single, Single)
- Source:
- Graphics.cs
- Source:
- Graphics.cs
绘制由一对坐标、高度和宽度指定的边界矩形定义的椭圆。
public:
void DrawEllipse(System::Drawing::Pen ^ pen, float x, float y, float width, float height);
public void DrawEllipse (System.Drawing.Pen pen, float x, float y, float width, float height);
member this.DrawEllipse : System.Drawing.Pen * single * single * single * single -> unit
Public Sub DrawEllipse (pen As Pen, x As Single, y As Single, width As Single, height As Single)
参数
- x
- Single
定义椭圆的边框左上角的 x 坐标。
- y
- Single
定义椭圆的边框左上角的 y 坐标。
- width
- Single
定义椭圆的边界矩形的宽度。
- height
- Single
定义椭圆的边界矩形的高度。
例外
pen
null
。
示例
下面的代码示例设计用于 Windows 窗体,它需要 PaintEventArgse
,这是 Paint 事件处理程序的参数。 该代码执行以下操作:
创建黑色笔。
创建矩形的位置和大小以绑定椭圆。
将椭圆绘制到屏幕。
private:
void DrawEllipseFloat( PaintEventArgs^ e )
{
// Create pen.
Pen^ blackPen = gcnew Pen( Color::Black,3.0f );
// Create location and size of ellipse.
float x = 0.0F;
float y = 0.0F;
float width = 200.0F;
float height = 100.0F;
// Draw ellipse to screen.
e->Graphics->DrawEllipse( blackPen, x, y, width, height );
}
private void DrawEllipseFloat(PaintEventArgs e)
{
// Create pen.
Pen blackPen = new Pen(Color.Black, 3);
// Create location and size of ellipse.
float x = 0.0F;
float y = 0.0F;
float width = 200.0F;
float height = 100.0F;
// Draw ellipse to screen.
e.Graphics.DrawEllipse(blackPen, x, y, width, height);
}
Private Sub DrawEllipseFloat(ByVal e As PaintEventArgs)
' Create pen.
Dim blackPen As New Pen(Color.Black, 3)
' Create location and size of ellipse.
Dim x As Single = 0.0F
Dim y As Single = 0.0F
Dim width As Single = 200.0F
Dim height As Single = 100.0F
' Draw ellipse to screen.
e.Graphics.DrawEllipse(blackPen, x, y, width, height)
End Sub
注解
此方法绘制由 x
、y
、width
和 height
参数描述的边界矩形定义的省略号。
适用于
DrawEllipse(Pen, RectangleF)
- Source:
- Graphics.cs
- Source:
- Graphics.cs
绘制由边界 RectangleF定义的椭圆。
public:
void DrawEllipse(System::Drawing::Pen ^ pen, System::Drawing::RectangleF rect);
public void DrawEllipse (System.Drawing.Pen pen, System.Drawing.RectangleF rect);
member this.DrawEllipse : System.Drawing.Pen * System.Drawing.RectangleF -> unit
Public Sub DrawEllipse (pen As Pen, rect As RectangleF)
参数
- rect
- RectangleF
定义椭圆边界的 RectangleF 结构。
例外
pen
null
。
示例
下面的代码示例设计用于 Windows 窗体,它需要 PaintEventArgse
,这是 Paint 事件处理程序的参数。 该代码执行以下操作:
创建黑色笔。
创建一个矩形来绑定椭圆。
将椭圆绘制到屏幕。
private:
void DrawEllipseRectangleF( PaintEventArgs^ e )
{
// Create pen.
Pen^ blackPen = gcnew Pen( Color::Black,3.0f );
// Create rectangle for ellipse.
RectangleF rect = RectangleF(0.0F,0.0F,200.0F,100.0F);
// Draw ellipse to screen.
e->Graphics->DrawEllipse( blackPen, rect );
}
private void DrawEllipseRectangleF(PaintEventArgs e)
{
// Create pen.
Pen blackPen = new Pen(Color.Black, 3);
// Create rectangle for ellipse.
RectangleF rect = new RectangleF(0.0F, 0.0F, 200.0F, 100.0F);
// Draw ellipse to screen.
e.Graphics.DrawEllipse(blackPen, rect);
}
Private Sub DrawEllipseRectangleF(ByVal e As PaintEventArgs)
' Create pen.
Dim blackPen As New Pen(Color.Black, 3)
' Create rectangle for ellipse.
Dim rect As New RectangleF(0.0F, 0.0F, 200.0F, 100.0F)
' Draw ellipse to screen.
e.Graphics.DrawEllipse(blackPen, rect)
End Sub
注解
此方法绘制由 rect
参数指定的边界矩形定义的省略号。
适用于
DrawEllipse(Pen, Rectangle)
- Source:
- Graphics.cs
- Source:
- Graphics.cs
绘制由边界 Rectangle 结构指定的省略号。
public:
void DrawEllipse(System::Drawing::Pen ^ pen, System::Drawing::Rectangle rect);
public void DrawEllipse (System.Drawing.Pen pen, System.Drawing.Rectangle rect);
member this.DrawEllipse : System.Drawing.Pen * System.Drawing.Rectangle -> unit
Public Sub DrawEllipse (pen As Pen, rect As Rectangle)
参数
例外
pen
null
。
示例
下面的代码示例设计用于 Windows 窗体,它需要 PaintEventArgse
,这是 Paint 事件处理程序的参数。 该代码执行以下操作:
创建黑色笔。
创建一个矩形来绑定椭圆。
将椭圆绘制到屏幕。
private:
void DrawEllipseRectangle( PaintEventArgs^ e )
{
// Create pen.
Pen^ blackPen = gcnew Pen( Color::Black,3.0f );
// Create rectangle for ellipse.
Rectangle rect = Rectangle(0,0,200,100);
// Draw ellipse to screen.
e->Graphics->DrawEllipse( blackPen, rect );
}
private void DrawEllipseRectangle(PaintEventArgs e)
{
// Create pen.
Pen blackPen = new Pen(Color.Black, 3);
// Create rectangle for ellipse.
Rectangle rect = new Rectangle(0, 0, 200, 100);
// Draw ellipse to screen.
e.Graphics.DrawEllipse(blackPen, rect);
}
Private Sub DrawEllipseRectangle(ByVal e As PaintEventArgs)
' Create pen.
Dim blackPen As New Pen(Color.Black, 3)
' Create rectangle for ellipse.
Dim rect As New Rectangle(0, 0, 200, 100)
' Draw ellipse to screen.
e.Graphics.DrawEllipse(blackPen, rect)
End Sub
注解
此方法绘制由 rect
参数指定的边界矩形定义的省略号。