ich glaube heute habe ich mal etwas schwieriges...
und zwar habe ich eine userform erstellt.
Beim laden der userform habe ich mit dem unten angefügten code es so hinbekommen das ich auf der form oben rechts die Icons habe zum (minimieren und maximieren) also zum ändern der größe des fensters.
Aber mein problem ist jetzt wenn ich minimiere also die userform in die taskleiste minimiere ist alles ok aber sobald ich das fenster maximiere wird dir userform zwar so groß wie mein monitor also mein Desktop aber der von mir erstellte Inhalt bleibt so groß wie ich ihn erstellt habe und ist nicht auf die fenstergröße angepasst.
Wie kann ich sowas am besten umsetzen ?
Vielen dank euch allen im vorraus !
'Code in der userform:
Private Sub UserForm_Activate()
Set objDieseUF.formular = Me
End Sub
'Code im Klassenmodul
Private Declare Function FindWindow _
Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Declare Function GetWindowLong _
Lib "user32" Alias "GetWindowLongA" _
(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
Private Declare Function ShowWindow _
Lib "user32" _
(ByVal hWnd As Long, _
ByVal nCmdShow As Long) As Long
Private Declare Function DrawMenuBar _
Lib "user32" _
(ByVal nWnd As Long) As Long
Private Declare Function SetFocus _
Lib "user32" _
(ByVal hWnd As Long) As Long
Private Const GWL_STYLE As Long = (-16)
Private Const GWL_EXSTYLE As Long = (-20)
Private Const WS_MINIMIZEBOX As Long = &H20000
Private Const WS_MAXIMIZEBOX As Long = &H10000
Private Const WS_EX_APPWINDOW As Long = &H40000
Private Const SW_HIDE As Long = 0
Private Const SW_SHOW As Long = 5
Dim objMinMaxUF As Object
Public Property Set formular(objUF As Object)
Dim lngUFHandle As Long
Dim lngFensterStil As Long
Set objMinMaxUF = objUF
lngUFHandle = FindWindow(vbNullString, objMinMaxUF.Caption)
lngFensterStil = GetWindowLong(lngUFHandle, GWL_STYLE)
lngFensterStil = lngFensterStil Or WS_MINIMIZEBOX Or WS_MAXIMIZEBOX
SetWindowLong lngUFHandle, GWL_STYLE, lngFensterStil
lngFensterStil = GetWindowLong(lngUFHandle, GWL_EXSTYLE)
lngFensterStil = lngFensterStil Or WS_EX_APPWINDOW
SetWindowLong lngUFHandle, GWL_EXSTYLE, lngFensterStil
ShowWindow lngUFHandle, SW_HIDE
DrawMenuBar lngUFHandle
ShowWindow lngUFHandle, SW_SHOW
SetFocus lngUFHandle
End Property
P.s vielleicht noch eine frage im anschluss.
Wie ist es möglich das ich die größe der Userform auch mit der maus ändern kann. Also die fenstergröße durch ziehen ändern kann ?
Danke