Hola amigos, he creado un resize para los controles de un formulario basandome en el publicado por GNU.
Este codigo funciona muy bien para la mayoria de los controles, pero, no consigo hacer que los controles IMAGE y PICTUREBOX ajusten su tamaño al de la pantalla.
Os paso el codigo :
Public Sub ResizeControls(frm As Form)
Dim i As Integer
Dim Objeto_Control As Control
Dim eje_x As Single
Dim eje_y As Single
If WindowState = vbMinimized Then Exit Sub
eje_x = frm.ScaleWidth / FormWidth
eje_y = frm.ScaleHeight / FormHeight
i = 1
For Each Objeto_Control In frm.Controls
With N_ControlPosicion(i)
If TypeOf Objeto_Control Is Timer Then
ElseIf TypeOf Objeto_Control Is StatusBar Then
ElseIf TypeOf Objeto_Control Is PictureBox Then
[color=red] 'con esto no consigo lo que me propongo[/color]
Objeto_Control.Width = (eje_x * .Width)
Objeto_Control.Height = (eje_y * .Height)
ElseIf TypeOf Objeto_Control Is Image Then
[color=red] 'con esto no consigo lo que me propongo[/color]
Objeto_Control.Width = (eje_x * .Width)
Objeto_Control.Height = (eje_y * .Height)
ElseIf TypeOf Objeto_Control Is Line Then
Objeto_Control.X1 = eje_x * .Left
Objeto_Control.Y1 = eje_y * .Top
Objeto_Control.X2 = Objeto_Control.X1 + eje_x * .Width
Objeto_Control.Y2 = Objeto_Control.Y1 + eje_y * .Height
Else
Objeto_Control.Left = eje_x * .Left
Objeto_Control.Top = eje_y * .Top
Objeto_Control.Width = eje_x * .Width
If Not (TypeOf Objeto_Control Is ComboBox) Then
Objeto_Control.Height = eje_y * .Height
End If
On Error Resume Next
Objeto_Control.Font.Size = eje_y * .FontSize
On Error GoTo 0
End If
End With
i = i + 1
Next Objeto_Control
End Sub
un saludo a todos y gracias por la ayudaaaaaa