hi all
I want the appearance of the key to Minimize, Maximize in userform
Minimize key Minimises the above taskbar
hi all
I want the appearance of the key to Minimize, Maximize in userform
Minimize key Minimises the above taskbar
Perhaps this is what you are looking for.
_
...How to Cross-post politely...
..Wrap code by selecting the code and clicking the # or read this. Thank you.
welcome mikerickson
thank you very much for your response and help Me
Benefited a lot of code listed to work
Try this one
code for module
and this one add to Userform![]()
Private Const GWL_STYLE As Long = -16 Public Const MIN_BOX As Long = &H20000 Public Const MAX_BOX As Long = &H10000 Const SC_CLOSE As Long = &HF060 Const SC_MAXIMIZE As Long = &HF030 Const SC_MINIMIZE As Long = &HF020 Const SC_RESTORE As Long = &HF120 Private Declare PtrSafe Function GetWindowLong _ Lib "user32.dll" _ Alias "GetWindowLongA" _ (ByVal hwnd As Long, _ ByVal nIndex As Long) As Long Private Declare PtrSafe Function SetWindowLong _ Lib "user32.dll" _ Alias "SetWindowLongA" _ (ByVal hwnd As Long, _ ByVal nIndex As Long, _ ByVal dwNewLong As Long) As Long Private Declare PtrSafe Function DrawMenuBar _ Lib "user32.dll" _ (ByVal hwnd As Long) As Long Private Declare PtrSafe Function GetForegroundWindow _ Lib "user32.dll" () As Long Public Sub AddToForm(ByVal Box_Type As Long) Dim BitMask As Long Dim Window_Handle As Long Dim WindowStyle As Long ' Dim Ret As Long If Box_Type = MIN_BOX Or Box_Type = MAX_BOX Then Window_Handle = GetForegroundWindow() WindowStyle = GetWindowLong(Window_Handle, GWL_STYLE) BitMask = WindowStyle Or Box_Type Ret = SetWindowLong(Window_Handle, GWL_STYLE, BitMask) Ret = DrawMenuBar(Window_Handle) End If End Sub
![]()
Private Sub UserForm_Activate() AddToForm MIN_BOX AddToForm MAX_BOX End Sub
Use Code-Tags for showing your code :
Please mark your question Solved if there has been offered a solution that works fine for you
If You like solutions provided by anyone, feel free to add reputation using STAR *
Haroon,
This is very helpful. It works perfectly and still restores the form back to its original size.
Regards,
For
for 32 bit version
remove PtrSafe From Private Function
![]()
Private Declare PtrSafe Function GetWindowLong _
Thank you HaroonSid
All right, that's it
is it possible to preserve the Zoom
In other words,
consistent with size of user form and controls
Try this sample
![]()
Private Const MResizer = "ResizeGrab" Private WithEvents objResizer As MSForms.Label Private LeftResizePos As Single Private TopResizePos As Single Private Sub UserForm_Initialize() Set objResizer = Me.Controls.Add("Forms.label.1", MResizer, True) With objResizer With .Font .Name = "Marlett" End With .AutoSize = True .Caption = "o" .MousePointer = fmMousePointerSizeNWSE .ForeColor = RGB(100, 100, 100) .ZOrder .Top = Me.InsideHeight - .Height .Left = Me.InsideWidth - .Width End With End Sub Private Sub objResizer_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) If Button = 1 Then LeftResizePos = X TopResizePos = Y End If End Sub Private Sub objResizer_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) On Error Resume Next If Button = 1 Then With objResizer .Move .Left + X - LeftResizePos, .Top + Y - TopResizePos Me.Width = Me.Width + X - LeftResizePos Me.Height = Me.Height + Y - TopResizePos If Me.Width < 250 Then Me.Width = 250 If Me.Height < 150 Then Me.Height = 150 .Left = Me.InsideWidth - .Width .Top = Me.InsideHeight - .Height End With TextBox1.Width = Me.InsideWidth - TextBox1.Left - 20 SpinButton1.Height = Me.InsideHeight - SpinButton1.Top - 6 End If End Sub Private Sub CloseBtn_Click() Unload Me End Sub
< ----- Please click the little star * next to add reputation if my post helps you
Visit Forum : From Here
Welcome AJalal
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks