ERROR EN RESOLUCION
Publicado por VICTOR (31 intervenciones) el 03/11/2009 18:58:52
hola programadores buscando en la web el problema de la resolucion fui a la pagina de microsoft y ellos dan un codigo que es el sgte:
Option Explicit
Dim myform As FRMSIZE
Dim DesignX As Integer
Dim DesignY As Integer
Private Sub Command1_Click()
On Error Resume Next
Dim ScaleFactorX As Single, ScaleFactorY As Single
DesignX = Xpixels
DesignY = Ypixels
RePosForm = True
DoResize = False
' Set up the screen values
Xtwips = Screen.TwipsPerPixelX
Ytwips = Screen.TwipsPerPixelY
Ypixels = Screen.Height / Ytwips ' Y Pixel Resolution
Xpixels = Screen.Width / Xtwips ' X Pixel Resolution
' Determine scaling factors
ScaleFactorX = (Xpixels / DesignX)
ScaleFactorY = (Ypixels / DesignY)
Resize_For_Resolution ScaleFactorX, ScaleFactorY, Me
Label1.Caption = "Current resolution is " & Str$(Xpixels) + _
" by " + Str$(Ypixels)
myform.Height = Me.Height ' Remember the current size
myform.Width = Me.Width
End Sub
Private Sub Form_Load()
On Error Resume Next
Dim ScaleFactorX As Single, ScaleFactorY As Single
'Scaling factors
' Size of Form in Pixels at design resolution
DesignX = 800
DesignY = 600
RePosForm = True ' Flag for positioning Form
DoResize = False ' Flag for Resize Event
' Set up the screen values
Xtwips = Screen.TwipsPerPixelX
Ytwips = Screen.TwipsPerPixelY
Ypixels = Screen.Height / Ytwips ' Y Pixel Resolution
Xpixels = Screen.Width / Xtwips ' X Pixel Resolution
' Determine scaling factors
ScaleFactorX = (Xpixels / DesignX)
ScaleFactorY = (Ypixels / DesignY)
ScaleMode = 1 ' twips
'Exit Sub ' uncomment to see how Form1 looks without resizing
Resize_For_Resolution ScaleFactorX, ScaleFactorY, Me
Label1.Caption = "Current resolution is " & Str$(Xpixels) + _
" by " + Str$(Ypixels)
'MyForm.Height = Me.Height ' Remember the current size
' MyForm.Width = Me.Width
myform.Height = Me.Height
myform.Width = Me.Width
End Sub
Private Sub Form_Resize()
Dim ScaleFactorX As Single, ScaleFactorY As Single
If Not DoResize Then ' To avoid infinite loop
DoResize = True
Exit Sub
End If
RePosForm = False
ScaleFactorX = Me.Width / myform.Width ' How much change?
ScaleFactorY = Me.Height / myform.Height
Resize_For_Resolution ScaleFactorX, ScaleFactorY, Me
myform.Height = Me.Height ' Remember the current size
myform.Width = Me.Width
End Sub
pero sale el sgte error
error 91 en tiempo de ejecucion:
variable de tipo object o la variable de bloque with no esta establecida
y me apunta a la variable myform
alguien me podria ayudar con este error
infinitas gracias
Option Explicit
Dim myform As FRMSIZE
Dim DesignX As Integer
Dim DesignY As Integer
Private Sub Command1_Click()
On Error Resume Next
Dim ScaleFactorX As Single, ScaleFactorY As Single
DesignX = Xpixels
DesignY = Ypixels
RePosForm = True
DoResize = False
' Set up the screen values
Xtwips = Screen.TwipsPerPixelX
Ytwips = Screen.TwipsPerPixelY
Ypixels = Screen.Height / Ytwips ' Y Pixel Resolution
Xpixels = Screen.Width / Xtwips ' X Pixel Resolution
' Determine scaling factors
ScaleFactorX = (Xpixels / DesignX)
ScaleFactorY = (Ypixels / DesignY)
Resize_For_Resolution ScaleFactorX, ScaleFactorY, Me
Label1.Caption = "Current resolution is " & Str$(Xpixels) + _
" by " + Str$(Ypixels)
myform.Height = Me.Height ' Remember the current size
myform.Width = Me.Width
End Sub
Private Sub Form_Load()
On Error Resume Next
Dim ScaleFactorX As Single, ScaleFactorY As Single
'Scaling factors
' Size of Form in Pixels at design resolution
DesignX = 800
DesignY = 600
RePosForm = True ' Flag for positioning Form
DoResize = False ' Flag for Resize Event
' Set up the screen values
Xtwips = Screen.TwipsPerPixelX
Ytwips = Screen.TwipsPerPixelY
Ypixels = Screen.Height / Ytwips ' Y Pixel Resolution
Xpixels = Screen.Width / Xtwips ' X Pixel Resolution
' Determine scaling factors
ScaleFactorX = (Xpixels / DesignX)
ScaleFactorY = (Ypixels / DesignY)
ScaleMode = 1 ' twips
'Exit Sub ' uncomment to see how Form1 looks without resizing
Resize_For_Resolution ScaleFactorX, ScaleFactorY, Me
Label1.Caption = "Current resolution is " & Str$(Xpixels) + _
" by " + Str$(Ypixels)
'MyForm.Height = Me.Height ' Remember the current size
' MyForm.Width = Me.Width
myform.Height = Me.Height
myform.Width = Me.Width
End Sub
Private Sub Form_Resize()
Dim ScaleFactorX As Single, ScaleFactorY As Single
If Not DoResize Then ' To avoid infinite loop
DoResize = True
Exit Sub
End If
RePosForm = False
ScaleFactorX = Me.Width / myform.Width ' How much change?
ScaleFactorY = Me.Height / myform.Height
Resize_For_Resolution ScaleFactorX, ScaleFactorY, Me
myform.Height = Me.Height ' Remember the current size
myform.Width = Me.Width
End Sub
pero sale el sgte error
error 91 en tiempo de ejecucion:
variable de tipo object o la variable de bloque with no esta establecida
y me apunta a la variable myform
alguien me podria ayudar con este error
infinitas gracias
Valora esta pregunta


0