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

Page 1 of 1

1 Replies - 2472 Views - Last Post: 17 December 2008 - 01:22 AM Rate Topic: -----

#1 shirish ojha  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 16-December 08

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

Post icon  Posted 16 December 2008 - 02:15 AM

how to resize all controls placed on a form according to the resolution of the screen
Is This A Good Question/Topic? 0
  • +

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

#2 B_Pra  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 08-July 08

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

Posted 17 December 2008 - 01:22 AM

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.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1