tags:

views:

206

answers:

1

Using VB6

Using MDI Forms, sub Forms also

When I run the Software in More than 15 Inch Screen, Crviewer Control, Frame Control, Everything is appearing in 75% of the screen, I Wrote the code for Crviewer Control in the form resize event.

Code

Private Sub Form_Resize()
    CRviewer2.Top = 1450
    CRviewer2.Left = 0
    CRviewer2.Height = ScaleHeight - 1450
    CRviewer2.Width = ScaleWidth
End Sub

Sometimes It is showing error, and sometimes it is executing, So there is any other code is available for all the control should appear in all types of windows screen Size

Please can any one help to solve the issues.

+3  A: 

There are a couple things you should modify about this code.

First, you should check the window state to make sure the window is not minimized. If it is minimized, the user cannot see the screen anyway, so you don't need to resize.

Second, you need to make sure you are not setting any of the properties to a value less than or equal to 0.

Third, you should have error handling in this code.

Private Sub Form_Resize()

    On Error Resume Next

    If Me.WindowState = vbMinimized Then
        Exit Sub
    End If

    CRviewer2.Top = 1450
    CRviewer2.Left = 0
    If ScaleHeight > 1450 Then
        CRviewer2.Height = ScaleHeight - 1450
    End If

    CRviewer2.Width = ScaleWidth
End Sub
G Mastros
What about frame, buttons. It will appear in screen size
Gopal
What about frame, buttons? Here's what about them. You have to write code that resizes them and moves them to where you want them.
MarkJ