Delete Drawn Lines

Status
Niet open voor verdere reacties.

RomeoGG

Nieuwe gebruiker
Lid geworden
2 mei 2019
Berichten
1
Hey,

Question I have used the code below to draw lines on a userform.

Does anyone know how to remove those lines.

I use this to let the user draw a design, with one touch of a button the design (all drawn lines) must be deleted.

Can someone help me with this?

Thanks


code:


Option Explicit
Private Declare Function GetDC& Lib "user32" (ByVal hWnd&)
Private Declare Function LineTo& Lib "gdi32" (ByVal hDc&, ByVal x&, ByVal y&)
Private Declare Function MoveToEx& Lib "gdi32" (ByVal hDc&, ByVal x&, ByVal y&, lpPoint As POINTAPI)
Private Declare Function GetActiveWindow& Lib "user32" ()

Private Type POINTAPI
x As Long
y As Long
End Type

Private hDc As Long

Private Sub DrawLine(ByVal X1&, ByVal Y1&, ByVal X2&, ByVal Y2&)
Dim pt As POINTAPI
MoveToEx hDc, X1, Y1, pt
LineTo hDc, X2, Y2
End Sub

Private Sub UserForm_Activate()
hDc = GetDC(GetActiveWindow)
Dim i As Byte
DoEvents
For i = 1 To 10
DrawLine 8, 8, i * 30, (Me.InsideHeight * 4 / 3) - 8
Next i
End Sub
 
Dit is een Nederlands forum.
Probeer dit:
Code:
Private Sub CommandButton1_Click()
    Me.Repaint
End Sub
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan