Private Sub CommandButton1_Click()
Frame1.Repaint
End Sub
Private Sub CommandButton2_Click()
'--- Réduit le UserForm à la taille de la Frame ---
Me.Width = Frame1.Width
Me.Height = Frame1.Height
'--- Libère le presse-papiers ---
OpenClipboard 0&
EmptyClipboard
CloseClipboard
'--- Copie et colle la fenêtre active ---
keybd_event vbKeySnapshot, 1&, 0&, 0&
On Error Resume Next
Do
Err.Clear
DoEvents
Sheets(1).Paste
Loop Until Err = 0
On Error GoTo 0
'--- Décharge l'USF ---
Unload Me
End Sub
Private Sub CommandButton3_Click()
Unload Me
End Sub
Private Sub Frame1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal y As Single)
If Button = 1 Then SetDrawStart x, y
End Sub
Private Sub Frame1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal y As Single)
If Button = 1 Then Draw x, y
End Sub
Private Sub UserForm_Activate()
Dim Hndl&
'--- Retire la barre titre de l'USF ---
Hndl& = FindWindow("Thunder" & IIf(Application.Version Like "8*", "0*", "D") & "Frame", UserForm1.Caption)
SetWindowLong Hndl&, -16, GetWindowLong(Hndl&, -16) And Not &HC00000
End Sub
Private Sub UserForm_Initialize()
Const PointsParPouce As Long = 72 '1 Inch = 72 Points [Postscript] | 1 Point = 0.01388888889 Inch
'---
X_Coeff2Points# = PointsParPouce / GetDeviceCaps(GetDC(Application.hWnd), LOGPIXELSX)
Y_Coeff2Points# = PointsParPouce / GetDeviceCaps(GetDC(Application.hWnd), LOGPIXELSY)
ReleaseDC 0, myHdc&
myHdc& = GetDC(UserForm1.Frame1.[_GethWnd])
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
ReleaseDC UserForm1.Frame1.[_GethWnd], myHdc&
End Sub