[問題] 如何每按一下畫一下圖
請問:
我有寫一畫圖的method:
protected override void OnPaint(PaintEventArgs e)
{
Graphics paint = e.Graphics;
//string color = Color.AliceBlue;
Pen pen = new Pen(Color.AliceBlue);
paint.DrawLine(pen, 272, 301, 91, 127);
paint.DrawLine(pen, 91, 127, 167, 103);
}
但是我希望我每按button 一下就呼叫一下畫圖的method: OnPaint,
把我載入的圖片(資料結構: picturebox)當argument傳入OnPaint去
但好像行不通>"<
private void Draw_CG_Click(object sender, EventArgs e)
{
OnPaint(plate); //這行行不通,plate是資料結構picturebox的var.
}
1. 不知該如何implemnt這樣的方法才好?
2. 我是該從toolbox上抓一個下來裡面default就會有PaintEventArgs, 我就可以
按一下它就在圖上畫一下圖? 若有,為何?
謝謝大家!!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.115.155.193
→
08/20 21:25, , 1F
08/20 21:25, 1F
→
08/20 21:25, , 2F
08/20 21:25, 2F
→
08/20 22:01, , 3F
08/20 22:01, 3F
討論串 (同標題文章)
C_Sharp 近期熱門文章
PTT數位生活區 即時熱門文章