작동하지 않는 버튼을 사용하여 선을 만들려고합니다. 단추를 그릴 vb.net 줄이 작동하지 않습니까?
나는 다음과 같은 코드를 사용하는 경우
,Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Windows.Forms
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
Dim g As Graphics = e.Graphics
Dim pn As New Pen(Color.Blue)
Dim pt1 As New Point(30, 30)
Dim pt2 As New Point(110, 100)
g.DrawLine(pn, pt1, pt2)
End sub
그것은 완벽하게 작동,하지만 난 단지 버튼 등을 클릭 한 후 그리려는 경우,
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Windows.Forms
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim g As Graphics = e.Graphics
Dim pn As New Pen(Color.Blue)
Dim pt1 As New Point(30, 30)
Dim pt2 As New Point(110, 100)
g.DrawLine(pn, pt1, pt2)
End Sub
그것은 말한다 " '그래픽' 'System.EventArgs'의 멤버가 아닙니다. ???
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
에 :
은 또한 변화 시도Private Sub Button1_Click(ByVal sender As graphics.Object, ByVal e As System.EventArgs) Handles Button1.Click
그리고 몇 시뮬 변화 (많은 것에 목록으로)하지만 난 오류 응답의 alsorts를 얻을.
그렇다면 그래프를 사용하여 버튼 클릭으로 어떻게 선을 그립니까 ???