首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

GDI+图片移动的有关问题

2011-12-30 
GDI+图片移动的问题BitmapbmpnewBitmap( D:\\***.gif )GraphicsgGraphics.FromHwnd(this.Handle)g.D

GDI+图片移动的问题
Bitmap   bmp   =   new   Bitmap( "D:\\***.gif ");
  Graphics   g   =   Graphics.FromHwnd(this   .Handle   );
  g.DrawImage(bmp,   200,   400);

  向路过的各位技术前辈求教:
  我该如何清除这个图片???!!!!!!!!
  我该如何在timer控件的事件中实现图片移动的效果??


[解决办法]
Graphics g = Graphics.FromHwnd(this .Handle );
g.DrawImage(bmp, x, y); //x,y是初始位置的坐标
g.Dispose();
把上面代码写在paint时间里面

private void timer1_Tick(object sender, EventArgs e)
{
x += 5; //横向移动
this.this.Invalidate();

}

热点排行