0
我有一点点prolem绘制位图到屏幕上一个位图,我试图用对MSDN库中的显示方式,这部分工作,但他们并没有真正给出一个很好的例子,在那里,只是specyfying你需要PaintEventHandler。绘图使用的DrawImage
所以这是我的代码:
public class UI {
public static void DrawTexture(string path, int x, int y, PaintEventArgs e) {
Bitmap BM = new Bitmap(path);
e.Graphics.DrawImage(BM, x, y);
}
}
现在,这个应该工作,但在调用函数时,问题就来了:
UI.DrawTexture("somepic.png", 1,1, /* What to put in here? */);
我在表单中使用它也尝试:
private void Form1_Load(object sender, EventArgs e, PaintEventArgs p) {
UI.DrawTexture("somepic.png", 1,1, p);
}
这给我一个错误在调试时:“不超载的Form1_Load的匹配委托System.EventHand LER“。
我在哪里错了?
非常感谢。 – user2948815