完成下面的程序段,绘制椭圆并进行填充Graphics g=this.CreateGraphics()

完成下面的程序段,绘制椭圆并进行填充Graphics g=this.CreateGraphics(),第1张

Graphics..::.FillPath 方法

填充 GraphicsPath 的内世枯拍败咐部。

public void FillPathEllipse(PaintEventArgs e)

{

/搜羡/ Create solid brush.

SolidBrush redBrush = new SolidBrush(Color.Red)

// Create graphics path object and add ellipse.

GraphicsPath graphPath = new GraphicsPath()

graphPath.AddEllipse(0, 0, 200, 100)

// Fill graphics path to screen.

e.Graphics.FillPath(redBrush, graphPath)

}

要不你这样看看

Graphics g = this.CreateGraphics()

Brush t=new SolidBrush(Color.Red)

g.FillPath(t,??)

1、首先定义升樱一个椭圆方程

2、首先将椭圆的方程改写好扮为参数方程友笑灶。

3、启动matlab写入:

>>t=linspace(0,2*pi,1000)

>>x=-2+2*cos(t)

>>y=6+3*sin(t)

>>plot(x,y),grid on

4、在代码框回车可以直接执行代码,画出椭圆。


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/yw/12489204.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2025-08-25
下一篇2025-08-25

发表评论

登录后才能评论

评论列表(0条)

    保存