Vielen Dank für eure Hilfe!!!!
Aber mein Code ist leider ein wenig komplexer aufgebaut - ich habe ihn mir irgendwo mal zusammengeschnibbelt und nun wollte ich es eben anpassen. Hier versuche mal hier den Code der Control einzufügen. Wie gesagt: ich will eine Grafik, optimalerweise eine PNG, im Hintergrund einfügen, welche ich bisher im Projekt per GDI+ einlese:
Private Type PictureProperties
hDC As Long
hPic As Long
SizeX As Long
SizeY As Long
End Type
Private Type VU_Position
centerX As Long
centery As Long
End Type
Private Type VU_Scale
scaleX As Double
scaleY As Double
End Type
Private Type VU_Needle
centerpos As VU_Position
scale As VU_Scale
needletype As Integer
Color As Long
operationmode As Integer
Value As Double
newvalue As Double
a As VU_NeedleAnimation
End Type
Private Type VU_Ticks
centerpos As VU_Position
scale As VU_Scale
small_amp1 As Double
small_amp2 As Double
small_color As Long
small_tickness As Long
interval_small As Long
large_amp1 As Double
large_amp2 As Double
large_color As Long
large_tickness As Long
interval_large As Long
min_value As Double
max_value As Double
minpos_angle As Long
maxpos_angle As Long
End Type
Private Type VUmeter
pic As PictureProperties
needle As VU_Needle
ticks As VU_Ticks
scale As VU_ScaleTxt
End Type
Private Const M_PI = 3.14159265358979
Private VUm As VUmeter
...
Private Sub DrawRectangle(hDC As Long, ByVal iX1 As Long, ByVal iY1 As Long, _
ByVal iX2 As Long, ByVal iY2 As Long, ByVal linewidth As Integer, ByVal _
clrline As Long, ByVal clrfill As Long, Optional ByVal penstyle As Long = 0)
Dim hPn As Long, hPnOld As Long
Dim hBr As Long, hBrOld As Long
hPn = CreatePen(penstyle, linewidth, clrline)
hPnOld = SelectObject(hDC, hPn)
hBr = CreateSolidBrush(clrfill)
hBrOld = SelectObject(hDC, hBr)
Rectangle hDC, iX1, iY1, iX2, iY2
SelectObject hDC, hBrOld
DeleteObject hBr
SelectObject hDC, hPnOld
DeleteObject hPn
End Sub
Private 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 SetVUDefaults(ByVal cx As Long, ByVal cy As Long) ' 0 = speedo
' meter; 1 = VU meter
Init_Ticks cx, cy, 1, 1, 0, dMaxValue, 220, -30, 5, 10, RGB(64, 64, 64), _
RGB(128, 128, 128), 1, 2, 0.9, 1, 0.85, 1
Init_Scale cx, cy, 0.6, 0.6, 20, "Arial", 12, False, False, "0", RGB(255, _
0, 0)
Init_Needle cx, cy, 1, 1, 4, 2, RGB(255, 0, 0)
End Sub
Private 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 Init_Ticks(ByVal centerX As Long, ByVal centery As Long, ByVal _
scaleX As Double, ByVal scaleY As Double, ByVal min_value As Double, ByVal _
max_value As Double, ByVal minpos_angle As Long, ByVal maxpos_angle As Long, _
ByVal tickinterval_small As Long, ByVal tickinterval_large As Long, ByVal _
smallcolor As Long, ByVal largecolor As Long, ByVal small_thickness As Long, _
ByVal large_thickness As Long, ByVal small_amp1 As Double, ByVal small_amp2 _
As Double, ByVal large_amp1 As Double, ByVal large_amp2 As Double)
VUm.ticks.centerpos.centerX = centerX
VUm.ticks.centerpos.centery = centery
VUm.ticks.scale.scaleX = scaleX
VUm.ticks.scale.scaleY = scaleY
VUm.ticks.min_value = min_value
VUm.ticks.max_value = max_value
VUm.ticks.minpos_angle = minpos_angle
VUm.ticks.maxpos_angle = maxpos_angle
VUm.ticks.interval_small = tickinterval_small
VUm.ticks.interval_large = tickinterval_large
VUm.ticks.small_color = smallcolor
VUm.ticks.large_color = largecolor
VUm.ticks.small_tickness = small_thickness
VUm.ticks.large_tickness = large_thickness
VUm.ticks.small_amp1 = small_amp1
VUm.ticks.small_amp2 = small_amp2
VUm.ticks.large_amp1 = large_amp1
VUm.ticks.large_amp2 = large_amp2
End Sub 0 |