用RoundRect函数画圆角矩形,但出现了怪的现象……
Option Explicit
Private Declare Function RoundRect Lib "GDI32" (ByVal hDC As Long, ByVal x1 As Long, ByVal y1 As Long, ByVal x2 As Long, ByVal y2 As Long, ByVal x3 As Long, ByVal y3 As Long) As Long
Dim x1, y1, x2, y2
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
x1 = X
y1 = Y
x2 = X
y2 = Y
Picture1.ScaleMode = 3
Picture1.FillColor = vbBlue
Picture1.FillStyle = 0
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
x2 = X
y2 = Y
End Sub
Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Picture1.ForeColor = vbRed
RoundRect Picture1.hDC, x1, y1, x2, y2, 10, 10 '调用API函数进行绘图
End Sub
'---------------------------------------------------------
'这什么画第一个的时候总是从右下角跑出来的?
'第二个开始就正常了……
'搞了半天都不明所以。