Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
Resizing Forms and Controls
Author:
Daniel Ionescu
E-mail:
Click to e-mail author
Submitted:
7/27/2004
Version:
VB6
Compatibility:
VB6
Category:
Forms
Views:
16247
Because there isn't a fully automatic way to resize the controls that are built into Visual Basic this solution will give you some tips on how to handle this with just a little bit of code.
Declarations:
Dim lngSpacer As Long Dim lngBttnWidth As Long
Code:
'Put a text box in the upper left-hand corner of the form with a small margin on the left and top of it. 'Draw a PictureBox on the form. Set the Align property to Align Bottom, set the Appearance to Flat, and set the BackColor to the Menu Bar color. This provides a place for your Command buttons. 'Draw your OK and Cancel buttons in the PictureBox and center them in the PictureBox. Private Sub Form_Resize() lngSpacer = cmdCancel.Left - cmdOK.Left - cmdOK.Width lngBttnWidth = lngSpacer + cmdCancel.Width + cmdOK.Width txtText.Height = picPanel.Top - (2 * txtText.Top) txtText.Width = Me.ScaleWidth - (2 * txtText.Left) cmdOK.Left = (picPanel.Width - lngBttnWidth) / 2 cmdCancel.Left = cmdOK.Left + cmdOK.Width + lngSpacer End Sub
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement