看板 Visual_Basic 關於我們 聯絡資訊
各位好 我用VS2012 visual C# 繪圖 以下是我的code using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApplication6 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { } private void Form1_Paint(object sender, PaintEventArgs e) { Graphics G = e.Graphics; // 取得畫布方法二 G.DrawLine(Pens.Black, 0, 0, 100, 100); //在 Form1 的畫布上畫直線 } } } 按下play之後 卻沒有畫出線條.. 這是我看書上的範例 請問 哪裡出現問題了嗎? 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 111.185.90.33
brighte:我知道為什麼了^^ 07/24 18:13
brighte:因為我沒有加上這句 07/24 18:13
brighte:this.Paint += new System.Windows.Forms. 07/24 18:14
brighte:PaintEventHandler(this.Form1_Paint); 07/24 18:14