Click to See Complete Forum and Search --> : Screen Resoluiton


ritesh_paul
June 23rd, 2001, 06:25 AM
Hi everyone,
I am having problem with the screen resolution in VB. how can i make my project( the screen designing) to look good on every system ?

shree
June 23rd, 2001, 07:44 AM
The following is a simple code that you can use to make a form designed in 800x600 mode uniform over all resolutions.

private Sub Form_Load()
on error resume next
Dim CtrlVar as Control
Xratio = Screen.Width / (Screen.TwipsPerPixelX * 800)
Yratio = Screen.Height / (Screen.TwipsPerPixelY * 600)
for Each CtrlVar In FrmVar.Controls
CtrlVar.Left = CtrlVar.Left * Xratio
CtrlVar.Top = CtrlVar.Top * Yratio
CtrlVar.Width = CtrlVar.Width * Xratio
CtrlVar.Height = CtrlVar.Height * Yratio
CtrlVar.Font.Size = CtrlVar.Font.Size * XRatio
next CtrlVar
End Sub

kevin shen
October 11th, 2001, 08:45 PM
Actuallu i find it's not working well. The calculation for XRatio and YRatio is incorrect. Maybe we need to use other property something? like scalex?

Thanks!

Best Regards,

Kevin Shen