Solved

preventing form resizing...

Posted on 2000-03-25
5
187 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 15 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

688 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