0

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.

1 Answer 1

3

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
Sign up to request clarification or add additional context in comments.

2 Comments

What about frame, buttons. It will appear in screen size
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.