How can you prevent a MDIform from being resized? 
Author Message
 How can you prevent a MDIform from being resized?

I tried to set the .height & .width props in the resize event of the
MDIform, but i got an error telling me that i can't do that while the form
resizes. Is there a way to prevent this? Thanks!


Sun, 27 Jan 2002 03:00:00 GMT  
 How can you prevent a MDIform from being resized?
Option Explicit
Dim maxwidth As Long
Dim maxheight As Long

Private Sub MDIForm_Initialize()

    maxheight = Me.Height
    maxwidth = Me.Width

End Sub

Private Sub MDI_Form.Resize()

    ' Remove the "Or Me.WindowState = vbMinimized" if you want the user to
be able to minimize the form.
    If Me.WindowState = vbMaximized Or Me.WindowState = vbMinimized Then
        Me.WindowState = vbNormal
    End If
    Me.Width = maxwidth
    Me.Height = maxheight

End Sub

Hope this is what you're looking for.
-- Keith Rudolph


Quote:
> I tried to set the .height & .width props in the resize event of the
> MDIform, but i got an error telling me that i can't do that while the form
> resizes. Is there a way to prevent this? Thanks!



Sun, 27 Jan 2002 03:00:00 GMT  
 How can you prevent a MDIform from being resized?
an even cleaner way which will not cause your form to flash is to subclass
your form and watch for the WM_MINMAXINFO message.  This message gives you
complete control over window sizes and positions.

Email me if you need some sample code if you want to go this route.

jesse

Quote:

>Option Explicit
>Dim maxwidth As Long
>Dim maxheight As Long

>Private Sub MDIForm_Initialize()

>    maxheight = Me.Height
>    maxwidth = Me.Width

>End Sub

>Private Sub MDI_Form.Resize()

>    ' Remove the "Or Me.WindowState = vbMinimized" if you want the user to
>be able to minimize the form.
>    If Me.WindowState = vbMaximized Or Me.WindowState = vbMinimized Then
>        Me.WindowState = vbNormal
>    End If
>    Me.Width = maxwidth
>    Me.Height = maxheight

>End Sub

>Hope this is what you're looking for.
>-- Keith Rudolph



>> I tried to set the .height & .width props in the resize event of the
>> MDIform, but i got an error telling me that i can't do that while the
form
>> resizes. Is there a way to prevent this? Thanks!



Mon, 28 Jan 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. preventing resize in a MDIform

2. How to prevent MDIform to be maximize

3. How to resize the picture in MDIForm ?

4. MdiForm resize

5. Att gurus Resizing the picute in the backgournd of an MDIForm

6. MdiForm Resize Disable

7. Resizing mdiform background picture

8. Disabling Minimize/Maximize/Resize on MDIForm?

9. How can you prevent a MDIform from being resized?

10. Preventing DataGrid Row/Column Resizing At Runtime

11. How do I prevent the resizing of rows in a DataGid

12. preventing usercontrol resize of one dimension only

 

 
Powered by phpBB® Forum Software