Private Const ALTERNATE = 1
Private Const WINDING = 2
Private Type POINTAPI
x As Long
y As Long
End Type
Private Declare Function SetPolyFillMode Lib "gdi32" (ByVal hdc As Long, ByVal nPolyFillMode As Long) As Long
Private Declare Function GetPolyFillMode Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function Polygon Lib "gdi32" (ByVal hdc As Long, lpPoint As POINTAPI, ByVal nCount As Long) As Long
Private Sub Form_Activate()
Me.AutoRedraw = True
Me.ScaleMode = vbPixels
Dim MP(1 To 3) As POINTAPI, Cnt As Long
MP(1).x = 3
MP(1).y = 10
MP(2).x = 200
MP(2).y = 50
MP(3).x = 10
MP(3).y = 60
Me.FillStyle = vbSolid
Me.FillColor = RGB(255, 0, 0)
If GetPolyFillMode(Me.hdc) <> WINDING Then SetPolyFillMode Me.hdc, WINDING
Polygon Me.hdc, MP(1), 3
End Sub
Et donc, que vaut-il mieux faire: utiliser FillColor et FillStyle ou les API CreateSolidBrush et selectObject? L'un est-il plus rapide que l'autre pour afficher un grand nombre de polygones?