vb.net窗体绘图问题,Form的Resize事件不能调用以下过程,求解!谢谢
Dimx,hAsIntegerSubhuatu()x=Form1.Width*0.1h=x*0.9DimgAsGraphicsg=Form1.CreateGraphics...
Dim x, h As Integer
Sub huatu()
x = Form1.Width * 0.1
h = x * 0.9
Dim g As Graphics
g = Form1.CreateGraphics
g.Clear(Color.White)
Dim mypen As New Pen(Color.Black, 3)
For i = 0 To 9
Select Case i
Case 0, 3, 6, 9
g.DrawLine(mypen, x, x + i * h, x + 9 * h, x + i * h)
g.DrawLine(mypen, x + i * h, x, x + i * h, x + 9 * h)
Case Else
g.DrawLine(Pens.Black, x, x + i * h, x + 9 * h, x + i * h)
g.DrawLine(Pens.Black, x + i * h, x, x + i * h, x + 9 * h)
End Select
Next
g.Dispose()
End Sub
form的paint事件也可以,但是有问题就是paint事件动作太频繁,而且窗体变小时不能激起paint事件 展开
Sub huatu()
x = Form1.Width * 0.1
h = x * 0.9
Dim g As Graphics
g = Form1.CreateGraphics
g.Clear(Color.White)
Dim mypen As New Pen(Color.Black, 3)
For i = 0 To 9
Select Case i
Case 0, 3, 6, 9
g.DrawLine(mypen, x, x + i * h, x + 9 * h, x + i * h)
g.DrawLine(mypen, x + i * h, x, x + i * h, x + 9 * h)
Case Else
g.DrawLine(Pens.Black, x, x + i * h, x + 9 * h, x + i * h)
g.DrawLine(Pens.Black, x + i * h, x, x + i * h, x + 9 * h)
End Select
Next
g.Dispose()
End Sub
form的paint事件也可以,但是有问题就是paint事件动作太频繁,而且窗体变小时不能激起paint事件 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询