Ich bin neu hier und bin noch Anfänger in VBA.
Ich zeichne mit VBA ihn Excel auf einer Userform einen Grafik mit API(Code unten) funktionen. Jetzt müsste ich die Grafik löschen um neue zu Zeichnen.
Wie kann ich die Grafik auf der Form ganz löschen?
Gibt es in Excel ein OnShow Event?
Wenn ich nämlich die Grafik gezeichnet habe und ich dann ein andere Fenster in den vordergrund nehme und wieder zurück wechsel ist die gezeichnete Grafik gelöscht. Wie kann ich dies lösen?
Mit freundlichen Grüssen
Franz
Private Declare Function GetForegroundWindow Lib "user32.dll" () As Long
Private Declare Function GetDC Lib "user32.dll" (ByVal hWnd As Long) As Long
Private Declare Function TextOut Lib "gdi32.dll" Alias "TextOutA" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal lpString As String, ByVal nCount As Long) As Long
Private Declare Function SetBkMode Lib "gdi32.dll" (ByVal hdc As Long, ByVal nBkMode As Long) As Long
Private Declare Function SetTextColor Lib "gdi32.dll" (ByVal hdc As Long, ByVal crColor As Long) As Long
Private Declare Function LineTo Lib "gdi32.dll" (ByVal hdc As Long, ByVal x As Long, ByVal y 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 POINTAPI) As Long
Private Type POINTAPI
x As Long
y As Long
End Type
Private hWnd As Long