[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 423
  • Last Modified:

Disabling form sizing when borderstyle is set to 2-sizable

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
Gordon_Atherley
Asked:
Gordon_Atherley
1 Solution
 
vinnyd79Commented:
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
 
Gordon_AtherleyAuthor Commented:
Thanks vinnyd79. I'll try this and report back.
0
 
vinnyd79Commented:
There is also a good example here using sub-classing:

http://vbnet.mvps.org/index.html?code/subclass/minmaxinfo.htm
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
Erick37Commented:
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
 
Ioannis ParaskevopoulosCommented:
And have the maxbutton property of the form set to false.
0
 
Gordon_AtherleyAuthor Commented:
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

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now