Chat LIVE With Programming Experts! There Are 23 Online Right Now...

Welcome to Dream.In.Code
Become a VB Expert!

Join 244,282 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,150 people online right now. Registration is fast and FREE... Join Now!




how to resize all controls placed on a form according to the resolutio

 
Reply to this topicStart new topic

how to resize all controls placed on a form according to the resolutio, how to resize all controls placed on a form according to the resolutio

shirish ojha
16 Dec, 2008 - 01:15 AM
Post #1

New D.I.C Head
*

Joined: 16 Dec, 2008
Posts: 1

how to resize all controls placed on a form according to the resolution of the screen

User is offlineProfile CardPM
+Quote Post


B_Pra
RE: How To Resize All Controls Placed On A Form According To The Resolutio
17 Dec, 2008 - 12:22 AM
Post #2

New D.I.C Head
*

Joined: 8 Jul, 2008
Posts: 4


If your Main Form loads in Maximized, So you have to give the Left and Top values of each controls using the Main Form's width and height.Then whatever the resolution of your screen the controls of your main form will be placed properly on the main form.

Eg:

If you need to have a command button in the middle of your form. You could use this code.

Private Sub Form_Load()
Place_Contorls
End sub

Private Sub Form_Resize()
Place_Contorls
End Sub

Sub Place_Contorls()
Command1.Left = (Form1.Width / 2) - (Command.Width / 2)
Command1.Top = (Form1.Height/ 2) - (Command.Height / 2)
End sub

Then, whatever the resolution is , this will place Command1 in the middle of the form. If you resize the form the same thing will happen. If you have number of controls on your form you need to give their left and top values using other controls as well.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 7/4/09 02:18PM

Live VB Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month