作者su27 (su27)
看板Visual_Basic
标题Re: [.NET] 请问一个图形功能
时间Sun May 11 16:59:15 2008
我一般在form 上画线的方法
Dim grap1,grap2 As Graphics
1. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
grap2 = Me.CreateGraphics
End Sub
2. Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim pen1 As Pen
pen1 = New Pen(Color.Gold, 5)
grap2.DrawLine(pen1, 5, 5, 150, 150)
End Sub
现在要在picturebox画线 不动到原图 是要在哪宣告
我试过的方法 画出来的线 都显示在form 上面
我想到的方案 把图放入bitmap 在上面画好 在载入进去
这样可行吗 还是有更简单的方法
Private Sub PictureBox1_LoadCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.AsyncCompletedEventArgs) Handles PictureBox1.LoadCompleted
grap1 = Me.CreateGraphics
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim pen1 As Pen
pen1 = New Pen(Color.Gold, 5)
grap1.DrawLine(pen1, 5, 5, 150, 150)
End Sub
Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint
grap1 = Me.CreateGraphics
Dim pen1 As Pen
pen1 = New Pen(Color.Gold, 5)
grap1.DrawLine(pen1, 450, 450, 150, 150)
End Sub
--
"◢██◣ 呼呼呼~ 为什麽…我这麽爱你…
↙操B跑车 " ,█◥◥◥ ˊ 对不起,他有车。 ˋ ◢██◣
▄◣ ◤ ◎ ◎ ◣◢██◣ˊ █◥◥◥▌
◣◥◣ ◥ ▼◤ ▉█◥◥◥ ◤ ▇ ▇◤
██████ ◣ ╲██◣ ▉◤ ▄ ▄ ◥ █▲◤
██◤▄◥█▃ ◢ █▃●╲ ◤╲█"█◤ g121630作 ◢ ◣ ◣
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 116.118.151.23