hi all,
N good morning!

I am developing an application in vb. I had developed my application on my PC in 1024*768 screen resolution. When i rum my application in the same screen resolution then it runs properly but when i run my application on 800 * 600 sreen resolution then my some controls on form are not visible to user.

I try to solve this problem by using picture box and putting all controls on picture box but then also some controls are not visible to me.

Can anybody help me in solving this problem as soon as possible?

Thanks in advance.

Regards
Guest11

you need to resize and rearrange the controls based on system resolution. You need to use X and Y coordinates of the screen.

thanks for ur reply debasis.
Can you give me the example for that .
I have 108 controls on my form.

This code is just for one of the aspects: the left position. But the principle is the same for the top position. And if you want, the height and the width.

Use ratios to find the value that you need. In each situation, you need 4 values. One value has to be calculated.

On loading you can extract the original height and width of your form. And on a resize event, you can extract the new size and width of your form.

The values that you might want to change are the left, the top, the width, and height positions of your controls. You don't need a picture box to manage your controls. The new top, left, height, and width positions can be calculated with ratios based on its previous position.

Here's one formula for finding the new left position using ratios:
CurrentLeft / CurrentWidth = NewLeft/NewWidth

Use the same principle for calculating a new top position, height, etc.

Option Explicit
Dim lngOrigW As Long, lngOrigH As Long

Private Sub Form_Load()
   lngOrigW = Me.Width
   lngOrigH = Me.Height
End Sub

Private Sub Form_Resize()
On Error GoTo Resize_ERROR
Dim ctl As Control, lngCurLeft As Long, lngCurTop As Long
Dim lngNewLeft As Long, lngNewTop As Long, lngNewWidth As Long, lngNewHeight As Long
Dim lngCurWidth As Long, lngCurHeight As Long
   
   lngCurWidth = Me.Width
      Debug.Print 3, lngCurWidth
   lngCurHeight = Me.Height
      Debug.Print 4, lngCurHeight
   
For Each ctl In Controls
   Select Case TypeName(ctl)
   Case "CommandButton"
      lngCurLeft = ctl.Left
      lngNewLeft = (lngCurLeft * lngCurWidth) / lngOrigW
      ctl.Move lngNewLeft
   Case "Label"
   Case Else
   End Select
Next
   lngOrigW = lngCurWidth
   lngOrigH = lngCurHeight
Exit Sub
Resize_ERROR:

End Sub

Hi,

Place the Image Control on the Form, Make its property :
Strech = True
and in Form's Re-Size Event Write this Code:

1.
Image1.Width = Me.Width
2.
Image1.Height = Me.Height - 300

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.