Option Explicit
Private Declare Function BeginPath Lib "gdi32.dll" (ByVal hdc As Long) As Long
Private Declare Function EndPath Lib "gdi32.dll" (ByVal hdc As Long) As Long
Private Declare Function PolyBezierTo Lib "gdi32.dll" (ByVal hdc As Long, ByRef lppt As POINT, ByVal cPoints As Long) As Long
Private Declare Function PolyBezier Lib "gdi32.dll" (ByVal hdc As Long, ByRef lppt As POINT, ByVal cPoints As Long) As Long
Private Declare Function MoveToEx Lib "gdi32.dll" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByRef lpPoint As Any) As Long
Private Declare Function FlattenPath Lib "gdi32.dll" (ByVal hdc As Long) As Long
Private Declare Function GetPath Lib "gdi32.dll" (ByVal hdc As Long, ByRef lpPoint As Any, ByRef lpTypes As Any, ByVal nSize As Long) As Long
Private Type POINT
x As Long
y As Long
End Type
Private Sub Form_DblClick()
Dim p(1 To 4) As POINT, b() As Byte, i As Long, out() As POINT
With p(1): .x = 100: .y = 100: End With
With p(2): .x = 200: .y = 300: End With
With p(3): .x = 300: .y = 100: End With
With p(4): .x = 400: .y = 200: End With
BeginPath Me.hdc
MoveToEx Me.hdc, p(1).x, p(1).y, ByVal 0&
PolyBezierTo Me.hdc, p(LBound(p) + 1), UBound(p) - LBound(p)
EndPath Me.hdc
FlattenPath Me.hdc
ReDim out(1 To GetPath(Me.hdc, ByVal 0&, ByVal 0&, 0))
ReDim b(LBound(out) To UBound(out))
GetPath Me.hdc, out(LBound(out)), b(LBound(b)), UBound(b) - LBound(b) + 1
'Собственно, на этом всё.
'Визуализация.
PolyBezier Me.hdc, p(LBound(p)), UBound(p) - LBound(p) + 1
For i = LBound(out) To UBound(out)
Me.PSet (out(i).x, out(i).y), vbRed
Next
End Sub
Private Sub Form_Load()
Me.ScaleMode = vbPixels
Me.AutoRedraw = False
Me.Caption = "Doubleclick me"
Me.Width = 6975
Me.Height = 5025
Me.ForeColor = vbWhite
End Sub
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 54