Многоугольник с использованием Api функций - VB

Формулировка задачи:

Как нарисовать многоугольник с помощью мышки с использованием API Функций ???

Код к задаче: «Многоугольник с использованием Api функций - VB»

textual
Option Explicit
Private Type POINTAPI
        X As Long
        Y As Long
End Type
Private Declare Function PolyBezier Lib "gdi32.dll" (ByVal hdc As Long, lppt As POINTAPI, ByVal cPoints As Long) As Long
Private Declare Function PolyBezierTo Lib "gdi32.dll" (ByVal hdc As Long, lppt As POINTAPI, ByVal cCount As Long) As Long
Private Declare Function MoveToEx Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, lpPoint As Any) As Long
Private Declare Function LineTo Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long) As Long
Private Declare Function PolyPolygon Lib "gdi32.dll" (ByVal hdc As Long, lpPoint As POINTAPI, lpPolyCounts As Long, ByVal nCount As Long) As Long
Private Sub Command1_Click()
 Stroim
End Sub
Private Sub Stroim()
    Dim pts(0 To 6) As POINTAPI
    Dim numpoints(0 To 1) As Long
 
    Me.ForeColor = vbBlue
    'set the points belonging to the rectangle
    pts(0).X = 20: pts(0).Y = 10
    pts(1).X = 200: pts(1).Y = 10
    pts(2).X = 200: pts(2).Y = 190
    pts(3).X = 20: pts(3).Y = 190
    numpoints(0) = 4
    'set the points belonging to the triangle
    pts(4).X = 100: pts(4).Y = 0
    pts(5).X = 50: pts(5).Y = 100
    pts(6).X = 150: pts(6).Y = 100
    numpoints(1) = 3
    'draw the polygons
   PolyPolygon Me.hdc, pts(0), numpoints(0), 2
End Sub
Эта работа вам не подошла?

Вы всегда можете заказать любую учебную работу у наших авторов от 20 руб.

5   голосов, оценка 4.400 из 5


СДЕЛАЙТЕ РЕПОСТ