Thursday, July 22, 2010

Change the form size, the size of the control changes the



When we design the form, place a number of visual controls, such as Label, CommandButton, TextBox and so on. Of course, when the size of the position in the design are more coordination, but once in operation, the user changes the size of the form, and we The control does not change with the change form size, especially when the user maximizes the form, often in the form many controls are still squeeze the upper left corner of the phenomenon, looking uncomfortable ......

Well, now, how to solve this problem?

Form of course, to capture the Resize event!

Here's the code:
''The following two sentences on the Form of "universal" in the statement
dim FrmW as single''kept changing the width of the form before
dim frmH as single''kept changing the height of the form before

Private Sub Form_Load ()
if windowstate <> vbMinimized then
FrmW = me.Width
FrmH = me.Height
The above two modules''variable is initialized
end if
End Sub

Private Sub Form_Resize ()
if FrmW = 0 or FrmH = 0 then exit sub

dim MyCon as me.Controls
dim sig1 as single, sig2 as single
sig1 = Me.Width / FrmW
sig2 = Me.Height / FrmH
For Each MyCon In Me.Controls
If TypeOf MyCon Is Label Or _
TypeOf MyCon Is CommandButton Or _
TypeOf MyCon Is ListView Or _
TypeOf MyCon Is TextBox Then
With MyCon
. Left = Int (. Left backup bin conf config data eshow_sitemap.html generate.sh log maint sitemap.html svn tmp sig1)
. Top = Int (. Top backup bin conf config data eshow_sitemap.html generate.sh log maint sitemap.html svn tmp sig2)
. Width = Int (. Width backup bin conf config data eshow_sitemap.html generate.sh log maint sitemap.html svn tmp sig1)
. Height = Int (. Height backup bin conf config data eshow_sitemap.html generate.sh log maint sitemap.html svn tmp sig2)
End With
End If
Next MyCon

FrmW = Me.Width
FrmH = Me.Height

End Sub

I used the code above four visual controls: Label, CommandButton, ListView, TextBox, according to the specific circumstances of your form, you can automatically increase the visual controls you use.

If you add the above code in your form code, you will find a form to change the size, form of visual control of the size and position will change accordingly.







Recommended links:



JSN-1 (A) Digital Switching Introduction



video file formats



AlltoDVD VOB to MPEG



vob to mpg



Youtube To VHS Products



free download wmv to 3gp converter



Easy to use Screen Capture



Catalogs Access Control



Avex-Zune Video Converter



WMA to MP3 Converter



Converter flv to mp3



brief PUZZLE And Word Games



Picked ANTI-SPAM And Anti-Spy Tools



The MORE competition the more powerful Symantec



The process of selling a few tricks to meet with CEOs



No comments:

Post a Comment