XL 2016 Bouton reduire et bouton niveau inf. dans le userform

djidji225

XLDnaute Nouveau
Bonjour
comment allez vous ? bien j'espere
j'ai ce code ci qui devrait normalement me permettre de reduire et agrandir mon userform mais qui ne marche pas
Code:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowLongA Lib "user32" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Dim wLong As Long
Const GWL_STYLE = (-16), GWL_EXSTYLE = (-20), WS_SIZEBOX = &H40000, WS_TROIS_BOUTON = &H70000, WS_EX_APPWINDOW = &H40000

Private Sub UserForm_Initialize()
Dim hwnd As Long
hwnd = FindWindow(vbNullString, Me.Caption)
wLong = GetWindowLongA(hwnd, GWL_STYLE) Or WS_SIZEBOX Or WS_TROIS_BOUTON
SetWindowLong hwnd, GWL_STYLE, wLong
End Sub



MErci de bien vouloir m'aider a avancer dans mon projet
 

patricktoulon

XLDnaute Barbatruc
bonjour
tu vire tout ce qui concerne les api
tu colle ou intègre ceci
VB:
'**********************************************************************************************
'      Ajouter les deux boutons manquants dans la barre de titre  à l'UserForm  et le mouse resizepar les angles et les cotés
'patricktoulon
'**********************************************************************************************

'EXEMPLE
Private Sub UserForm_Activate()
    trois_boutons
End Sub

Private Sub trois_boutons()
    Dim hwnd&
    hwnd = ExecuteExcel4Macro("CALL(""user32"",""GetActiveWindow"",""JCC"")")         'api GetActiveWindow
    ExecuteExcel4Macro ("CALL(""user32"",""SetWindowLongA"",""JJJJJ""," & hwnd & ", " & -16 & ", " & &H94CF0080 & ")")     'api SetWindowLongA
End Sub
compatible 32/64bit sans déclaration
 

patricktoulon

XLDnaute Barbatruc
re
si tu parle de control image
utilise l'events resize du userform
VB:
Private Sub UserForm_Resize()
Image1.Move 0, 0, Me.InsideWidth, Me.InsideHeight
End Sub
si tu parle du fond de l'userform (la propriété ".picture")
tout simplement dans le activate
VB:
me.pictureSizeMode=1
 

Discussions similaires