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