private void Draw(Action a)
{
g.FillRectangle(backgroundBrush, left, top, SIZE, SIZE);
a();
g.FillRectangle(Brushes.SkyBlue, left, top, SIZE, SIZE);
} public void Up()
{
Draw(() => { top -= SIZE; });
}
如果反复调用Up(),是不是反复创建Action委托?
解决方案 »
- 添加tabpage的问题
- 就3句代码,怎么弄都不行,关于Decimal
- Winform 中DataGridview显示数据问题??
- 新手问个入门问题 SplitContainer 停靠
- 用process.modules访问被拒绝
- 对于多线程,怎么获取特定的线程,每个线程是否有唯一的标识符
- 再问treeview鼠标右键产生事件在服务器端的解决办法(高手都来看看)
- (100分)求WinForm中DataGridView的行头合并与列头合并问题,此外如何在Cell中显示图片,如何实现cell合并,如哪位又比较好的课程表与源代码,可以卖给我
- 大放分呀,来者有分.
- 在vs2005中,制作安装程序,怎么知道用户选的安装路径从而写入注册表?我是想做开机启动
- c#读取xml 的问题。
- c# 调用 C DLL时,类参数对应C#什么类型?结构?【急】
a每次都指向top -= SIZE;这句话。那top -= SIZE;是每次up都临时创建,用后销毁;还是始终存在,只是创建a时都把它指向top -= SIZE;?
以下代码跟主贴代码哪个更好? Action upAction; public Block(Graphics g, int left, int top)
{
this.g = g;
backgroundBrush = new SolidBrush(System.Drawing.SystemColors.Control);
this.left = left;
this.top = top; upAction= () => { top -= SIZE; };
} private void Draw(Action a)
{
g.FillRectangle(backgroundBrush, left, top, SIZE, SIZE);
a();
g.FillRectangle(Brushes.SkyBlue, left, top, SIZE, SIZE);
} public void Up()
{
Draw(upAction);
}