[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

preventing form resizing...

Posted on 2000-03-25
5
Medium Priority
?
190 Views
Last Modified: 2010-05-18
What is the best way to prevent the user from resizing the form?

I don't want to set the BroderStyle of the from to Fixed Single (because that hides the minimize button). I want it Resizable yet I don't want the user to be able to resize the form and miss up the carefully drawn controls.
0
Comment
Question by:mhdhallak
5 Comments
 
LVL 14

Expert Comment

by:wsh2
ID: 2657051
On your form.. Set the BorderStyle property to Fixed Single.. and then Set the MinButton and MaxButton properties to True.. and it will do all that you want it to.. <smile>.
0
 
LVL 7

Expert Comment

by:Vbmaster
ID: 2657112
You can use subclassing to get information when the user tries to resize the form. Check out...

http://www.vbaccelerator.com/codelib/ssubtmr/ctrlres.htm
0
 
LVL 2

Expert Comment

by:heheman3000
ID: 2657434
When the user resizes the from, you can get the controls to automatically resize themselves so they still fill up the form and get smaller and larger according to the form size (top, left, height, and width properties) Also, you can set the form so that it can't  go smaller then a specific size, so the controls are still visible.
0
 
LVL 3

Accepted Solution

by:
Foyal earned 45 total points
ID: 2657558
'Put all your controls inside a frame (fraMain)...

Option Explicit

    Dim DesiredWidth as Single
    Dim DesiredHeight as Single

Private Sub Form_Load()
   
    DesiredWidth = fraMain.Width + 360
    DesiredHeight = fraMain.Height + 600

End Sub

Private Sub Form_Resize()

    If me.WindowState <> vbMinimized then
        If Me.Width < DesiredWidth then
            Me.Width = DesiredWidth
        End If

        If Me.Height < DesiredHeight then
           Me.Height = DesiredHeight
        End If
   
    frmMain.Move (Me.Width - fraMain.Width)/ 2, (Me.Height - fraMain.Height) / 2
     
    End If

End Sub


0
 
LVL 3

Expert Comment

by:Foyal
ID: 2657562
ooops...
    In the Form_Resize that should be
    fraMain.Move instead of frmMain.Move

Experiment with the values set in the Form_Load to get the effect you want.

If your form.ScaleMode is set to pixels you will have to adjust things accordingly.

See 'ya
Foyal

0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question