清除fillEllipse图形 [英] clear fillEllipse graphics

查看:114
本文介绍了清除fillEllipse图形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个功能,每隔10秒填充椭圆,

特定的x,y,w,h。


现在我想要做相反,使用定时器每30秒用给定的x,y

清除椭圆。

或者我把这些(x,y,w,h)放到一个数组?

稍后返回数组并用与

背景相同的颜色填充椭圆?


有没有简单的方法?


谢谢..


//用计时器绘制的示例代码


private void drawNote(int x,int y,int width,int height,

SolidBrush brush)

{

Graphics graphicGlobal = this.CreateGraphics() ;

this.Show();


graphicGlobal.FillEllipse(画笔,x,y,宽度,高度);


}


//绘制计时器

private void timer_note_Tick(object sender,EventArgs e)

{

SolidBrush colorBrush = new SolidBrush(Color.Cyan);

SolidBrush colorBru sh2 =新的SolidBrush(Color.Magenta);


drawNote(x_global,y_global,width_global,height_global,

colorBrush);

drawNote(x_global + 15,y_global + 15,width_global,

height_global,colorBrush2);


x_global = x_global + 30;

y_global = y_global + 30;

}

解决方案

我认为你需要处理graphicGlobal 。


" Slickuser" < sl ********* @ gmail.comwrote in message

news:51 ********************* ************* @ d4g2000p rg.googlegroups.com ...


>我有这个函数将填充椭圆每隔10秒用

特定的x,y,w,h。


现在我想反过来,用给定的x,y清除椭圆

每隔30秒使用一次计时器。

或者我把这些(x,y,w,h)放到一个数组中?

后来去返回数组并用与

背景相同的颜色填充椭圆?


有简单的方法吗?


谢谢..


//用计时器绘制的示例代码


private void drawNote(int x,int y,int width,int高度,

SolidBrush画笔)

{

图形graphicGlobal = this.CreateGraphics();

this.Show ();


graphicGlobal.FillEllipse(画笔,x,y,宽度,高度);

}


//绘制计时器

private void timer_note_Tick(object sender,EventArgs e)

{

SolidBrush colorBrush =新的SolidBrush(Color.Cyan);

SolidBrush colorBrush2 =新的SolidBrush(Color.Magenta);


drawNote(x_global,y_global,width_global,height_global,

colorBrush);


drawNote(x_global + 15,y_global + 15,width_global,

height_global,colorBrush2);


x_global = x_global + 30;

y_global = y_global + 30;

}






" Slickuser"写道:


我有这个函数,每隔10秒填充椭圆,

特定的x,y,w,h。


现在我想要反过来,使用定时器每隔30秒用给定的x,y

清除椭圆。

或我把这些(x,y,w,h)放到一个数组中?

稍后返回数组并用与

背景相同的颜色填充椭圆?


有简单的方法吗?


谢谢..


//用于绘制的示例代码计时器


private void drawNote(int x,int y,int width,int height,

SolidBrush brush)

{

图形graphicGlobal = this.CreateGraphics();

this.Show();


graphicGlobal.FillEllipse(brush,x, y,宽度,高度);


}


//绘制计时器

private void timer_note_Tick(对象寄件人,EventArgs e)

{

SolidBrush colorBrush = new SolidBrush(Color.Cyan);

SolidBrush colorBrush2 = new SolidBrush(Color.Magenta) ;


drawNote(x_global,y_global,width_global,height_global,

colorBrush);


drawNote(x_global + 15,y_global + 15,width_global,

height_global,colorBrush2);


x_global = x_global + 30;

y_global = y_global + 30;

}



昨天在你的帖子中重读你的建议。看起来你好像是b $ b回到绘画活动之外的绘图。


如果我这样使用,我需要一些如何传递PaintEvents来绘制。

这就是为什么我选择这样做的方式。


11月30日凌晨4:53,Family Tree Mike

< FamilyTreeM ... @ discussion.microsoft.comwrote:


" Slickuser"写道:


我有这个函数,它将每10秒填充一次椭圆,

特定的x,y,w,h。


现在我想要反过来,用给定的x,y

清除椭圆,每30秒使用一次定时器。

或者我把这些(x,y,w,h)放到一个数组中?

稍后返回数组并用与
背景?


有简单的方法吗?


谢谢..


//用于绘制的示例代码timer


private void drawNote(int x,int y,int width,int height,

SolidBrush brush)

{

Graphics graphicGlobal = this.CreateGraphics();

this.Show();


graphicGlobal.FillEllipse(brush,x,y,width,height);


}


//绘制计时器

private void timer_note_Tick(object sender,EventArgs e)

{

SolidBrush colorBrush = new SolidBrush(Color.Cyan);

SolidBrush colorBrush2 =新的SolidBrush(Color.Magenta);


drawNote(x_global,y_global,width_global,height_global,

colorBrush);


drawNote(x_global + 15,y_global + 15,width_global,

height_global,colorBrush2);


x_global = x_global + 30;

y_global = y_global + 30;

}



昨天在你的帖子中重读你的建议。看起来你好像是b $ b回到绘画事件之外的绘图.-隐藏引用的文字 -


- 显示引用的文字 -


I have this function that will fill the ellipse every 10 seconds with
specific x,y,w,h.

Now I want do the the reverse, to clear the ellipse with given x,y
using Timer at every 30s.
Or I have put these (x,y,w,h) to an array?
Later go back the array and fill ellipse with the same color as
background?

Is there an easy way?

Thanks..

//Sample code that draw with timer

private void drawNote(int x, int y, int width, int height,
SolidBrush brush)
{
Graphics graphicGlobal = this.CreateGraphics();
this.Show();

graphicGlobal.FillEllipse(brush, x, y, width, height);

}

// Timer to draw
private void timer_note_Tick(object sender, EventArgs e)
{
SolidBrush colorBrush = new SolidBrush(Color.Cyan);
SolidBrush colorBrush2 = new SolidBrush(Color.Magenta);

drawNote(x_global, y_global, width_global, height_global,
colorBrush);

drawNote(x_global + 15, y_global + 15, width_global,
height_global, colorBrush2);

x_global = x_global + 30;
y_global = y_global + 30;
}

解决方案

I think you need to dispose of graphicGlobal.

"Slickuser" <sl*********@gmail.comwrote in message
news:51**********************************@d4g2000p rg.googlegroups.com...

>I have this function that will fill the ellipse every 10 seconds with
specific x,y,w,h.

Now I want do the the reverse, to clear the ellipse with given x,y
using Timer at every 30s.
Or I have put these (x,y,w,h) to an array?
Later go back the array and fill ellipse with the same color as
background?

Is there an easy way?

Thanks..

//Sample code that draw with timer

private void drawNote(int x, int y, int width, int height,
SolidBrush brush)
{
Graphics graphicGlobal = this.CreateGraphics();
this.Show();

graphicGlobal.FillEllipse(brush, x, y, width, height);

}

// Timer to draw
private void timer_note_Tick(object sender, EventArgs e)
{
SolidBrush colorBrush = new SolidBrush(Color.Cyan);
SolidBrush colorBrush2 = new SolidBrush(Color.Magenta);

drawNote(x_global, y_global, width_global, height_global,
colorBrush);

drawNote(x_global + 15, y_global + 15, width_global,
height_global, colorBrush2);

x_global = x_global + 30;
y_global = y_global + 30;
}





"Slickuser" wrote:

I have this function that will fill the ellipse every 10 seconds with
specific x,y,w,h.

Now I want do the the reverse, to clear the ellipse with given x,y
using Timer at every 30s.
Or I have put these (x,y,w,h) to an array?
Later go back the array and fill ellipse with the same color as
background?

Is there an easy way?

Thanks..

//Sample code that draw with timer

private void drawNote(int x, int y, int width, int height,
SolidBrush brush)
{
Graphics graphicGlobal = this.CreateGraphics();
this.Show();

graphicGlobal.FillEllipse(brush, x, y, width, height);

}

// Timer to draw
private void timer_note_Tick(object sender, EventArgs e)
{
SolidBrush colorBrush = new SolidBrush(Color.Cyan);
SolidBrush colorBrush2 = new SolidBrush(Color.Magenta);

drawNote(x_global, y_global, width_global, height_global,
colorBrush);

drawNote(x_global + 15, y_global + 15, width_global,
height_global, colorBrush2);

x_global = x_global + 30;
y_global = y_global + 30;
}

Reread the advise to you in your post yesterday. It looks like you are
going back to drawing graphics outside the paint event.


If I use that way, I need some how to pass in a PaintEvents to draw.
That how why I choose doing this way.

On Nov 30, 4:53 am, Family Tree Mike
<FamilyTreeM...@discussions.microsoft.comwrote:

"Slickuser" wrote:

I have this function that will fill the ellipse every 10 seconds with
specific x,y,w,h.

Now I want do the the reverse, to clear the ellipse with given x,y
using Timer at every 30s.
Or I have put these (x,y,w,h) to an array?
Later go back the array and fill ellipse with the same color as
background?

Is there an easy way?

Thanks..

//Sample code that draw with timer

private void drawNote(int x, int y, int width, int height,
SolidBrush brush)
{
Graphics graphicGlobal = this.CreateGraphics();
this.Show();

graphicGlobal.FillEllipse(brush, x, y, width, height);

}

// Timer to draw
private void timer_note_Tick(object sender, EventArgs e)
{
SolidBrush colorBrush = new SolidBrush(Color.Cyan);
SolidBrush colorBrush2 = new SolidBrush(Color.Magenta);

drawNote(x_global, y_global, width_global, height_global,
colorBrush);

drawNote(x_global + 15, y_global + 15, width_global,
height_global, colorBrush2);

x_global = x_global + 30;
y_global = y_global + 30;
}


Reread the advise to you in your post yesterday. It looks like you are
going back to drawing graphics outside the paint event.- Hide quoted text -

- Show quoted text -


这篇关于清除fillEllipse图形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆