Solved

Disabling form sizing when borderstyle is set to 2-sizable

Posted on 2004-10-24
404 Views
Last Modified: 2008-03-06
Hello experts

In my VB6 app, which uses a status bar, setting a form to any of the fixed options (0,1,3,4) causes it to cover the Windows tray and tray and status bar. Setting it to one of the sizable options (2,5) allows the Windows tray and status bar to be visible.

The form is always set to open with WindowState = vbNormal, and with MinButton and Maxbutton set to false.

But I don't want the user to be able to size the window.  Is there any way to disable user-controlled sizing while enabling Windows to maintain the view of its tray and status bar, please?

Gordon
0
Question by:Gordon_Atherley
    6 Comments
     
    LVL 28

    Expert Comment

    by:vinnyd79
    Have you tried setting variables in the Declarations section to hold the forms values,then checking the resize event?

    Dim frmHeight As Long
    Dim frmLeft As Long
    Dim frmWidth As Long


    Private Sub Form_Load()
    frmHeight = Me.Height
    frmLeft = Me.Left
    frmWidth = Me.Width
    End Sub

    Private Sub Form_Resize()
    Me.Height = frmHeight
    Me.Left = frmLeft
    Me.Width = frmWidth
    End Sub
    0
     

    Author Comment

    by:Gordon_Atherley
    Thanks vinnyd79. I'll try this and report back.
    0
     
    LVL 28

    Accepted Solution

    by:
    There is also a good example here using sub-classing:

    http://vbnet.mvps.org/index.html?code/subclass/minmaxinfo.htm
    0
     
    LVL 32

    Expert Comment

    by:Erick37
    Check the setting for the taskbar: Right Click the Taskbar, select Properties menu, check "Keep the Taskbar on Top of other Windows" (in VP).

    Also see:

    FIX: Form Covers Windows TaskBar Even If [Taskbar] Set as "Always on Top"
    http://support.microsoft.com/default.aspx?scid=kb;en-us;184343
    0
     
    LVL 23

    Expert Comment

    by:Ioannis Paraskevopoulos
    And have the maxbutton property of the form set to false.
    0
     

    Author Comment

    by:Gordon_Atherley
    Thanks to all for the advice.

    Vinnyd79's subclassing solution worked for my app; the Microsoft support solution didn't.

    With my form's BorderStyle set to sizable, the min and max buttons set to false, and WindowState set to maximised, I call the subclassing in the form load. The subclassing prevents the user resizing the form by dragging the borders.

    Setting the borderstyle to sizable is the only way I found to stop the form covering the Windows taskbar.
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
    This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
    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…

    933 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

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now