Hallo COmmunity,
ich habe mir folgenden Code zusammengeschnippelt:
Declare Function Polygon Lib "gdi32" (ByVal hDC As Long, lpPoint As POINTAPI, _
ByVal nCount As Long) As Long
Declare Function CreatePen Lib "gdi32" (ByVal nPenStyle As Long, ByVal nWidth _
As Long, ByVal crColor As Long) As Long
Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor As Long) As Long
Declare Function SelectObject Lib "gdi32" (ByVal hDC As Long, ByVal hObject As _
Long) As Long
Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Declare Function Rectangle Lib "gdi32" (ByVal hDC As Long, ByVal x1 As Long, _
ByVal y1 As Long, ByVal x2 As Long, ByVal y2 As Long) As Long
Declare Function LineTo Lib "gdi32" (ByVal hDC As Long, ByVal x As Long, ByVal _
y As Long) As Long
Declare Function MoveToEx Lib "gdi32" (ByVal hDC As Long, ByVal x As Long, _
ByVal y As Long, lpPoint As POINTAPI) As Long
Declare Function Ellipse Lib "gdi32" (ByVal hDC As Long, ByVal x1 As Long, _
ByVal y1 As Long, ByVal x2 As Long, ByVal y2 As Long) As Long
Declare Function SetPolyFillMode Lib "gdi32" (ByVal hDC As Long, ByVal _
nPolyFillMode As Long) As Long
Public Sub DrawFilledPolygon(ByVal hDC As Long, ByVal Total As Integer, points( _
) As POINTAPI, linewidth As Integer, clrline As Long, clrfill As Long)
Dim hPn As Long, hPnOld As Long
Dim hBr As Long, hBrOld As Long
hPn = CreatePen(0, linewidth, clrline)
hPnOld = SelectObject(hDC, hPn)
hBr = CreateSolidBrush(clrfill)
hBrOld = SelectObject(hDC, hBr)
SetPolyFillMode hDC, FLOODFILLSURFACE
Polygon hDC, points(0), Total
SelectObject hDC, hBrOld
DeleteObject hBr
SelectObject hDC, hPnOld
DeleteObject hPn
End Sub
Private Sub DrawVUNeedle()
...
DrawFilledPolygon VUm.pic.hDC, totalpoints, p2(), 1, RGB(128, 128, _
128), RGB(128, 128, 128)
End Sub
Public Sub Init_Picture(ByVal hDC As Long, ByVal hPic As Long, ByVal SizeX As _
Long, ByVal SizeY As Long)
VUm.pic.hDC = hDC
VUm.pic.hPic = hPic
VUm.pic.SizeX = SizeX
VUm.pic.SizeY = SizeY
End Sub
Private Sub Form_Load()
Init_Picture picGauge.hDC, picGauge.image, picGauge.ScaleWidth, _
picGauge.ScaleHeight
DrawNeedle
End Sub Das sind nur die wichtigsten Teile des SOurces.. meine Frage ist nun, da ich mit GDI+ Polygone in die PictureBox zeichne, wie ich denn die Picturebox vorher mit einer Grafik belegen und dann über diese Grafik die Polygone zeichnen kann?
Vielen Dank für eure Hilfe! 0 |