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
Code snippet which repositions and resizes all the...
Author:
Justin Manley
Submitted:
2/15/2000
Version:
VB5
Compatibility:
VB5,6
Category:
Forms
Views:
20350
Code snippet which repositions and resizes all the controls on a form whenever the form is resized.
Declarations:
Private Type CtrlProportions HeightProportions As Single WidthProportions As Single TopProportions As Single LeftProportions As Single End Type
Code:
Dim ProportionsArray() As CtrlProportions Sub InitResizeArray() On Error Resume Next Dim I As Integer ReDim ProportionsArray(0 To Controls.Count -1) For I = 0 To Controls.Count -1 With ProportionsArray(I) .HeightProportions = Controls(I).Height / ScaleHeight .WidthProportions = Controls(I).Width / ScaleWidth .TopProportions = Controls(I).Top / ScaleHeight .LeftProportions = Controls(I).Left / ScaleWidth End Width Next I End Sub Sub ResizeControls() On Error Resume Next Dim I As Integer For I = 0 To Controls.Count -1 With ProportionsArray(I) ' move and resize controls Controls(I).Move .LeftProportions * ScaleWidth, .TopProportions * ScaleHeight, .HeightProportions * ScaleHeight, .WidthProportions * ScaleWidth End With Next I End Sub 'Form initialize event Private Sub Form_Initialize() InitResizeArray End Sub 'Form resize event Sub Form_Resize() ResizeControls End Sub
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement