Private Sub Form1_paint(byval sender as object, byval e as system.windows.forms.paintEventArgs) handle MyBase.paint
Dim g as Graphic = e.Graphic
Dim P as Pen = New Pen(color.blue,5)
g.DrawRectangle(P,120,120,150,150)
g.Dispose()
End sub
复制代码
把form1 的 MyBase.paint set 进去
Private Sub Form1_paint(byval sender as object, byval e as system.windows.forms.paintEventArgs) handle MyBase.paint
定义一个 Graphic
Dim g as Graphic = e.Graphic
定义一个 Pen 蓝色,5的粗线
Dim P as Pen = New Pen(color.blue,5)
g 的地方用p 的笔来画 第一个 xy 点 120 120 和到 第二个 xy 点 150 150
g.DrawRectangle(P,120,120,150,150)
释放 g
g.Dispose()
End sub
for .net
要引进
system.drawing.drawing2d
system.drawing.text
system.drawing