Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Screen Refresh

Status
Not open for further replies.

RichS

Programmer
Joined
Apr 24, 2000
Messages
380
Location
US
I have a MDI form where I load multiple forms as needed. One of the Children is a main working form. Other minor forms can be called from the main working form. The problem is when the minor forms are closed the main working form does not refresh, redraw or repaint. It looks all messed up.

So far I've tried in the closing event of the minor forms:

Code:
mainform.Refresh

and minimizing and normalizing the form to reset it...

Code:
mainfrom.WindowState = FormWindowState.Minimized
mainform.WindowState = FormWindowState.Normal

Any ideas??
 
What kind of Refresh you want
You can write that code in the PAINT event of MDI but it will fire everytime the PAINT event occurs
if you can explain more then someone or me can give more better suggestion
Nouman
 
It's like when you open a form and then open a 2nd one over the first and then when you close the 2nd one you have this big hole in the 1st form where the 2nd used to be.

I just want to refresh the form or screen so the you don't have hole in whatever form is being displayed.

It is sort like when your graphics card locks up - although I doubt that this is a graphics card issue as this is happening on 3 disimilar pc's.
 
For any others who are interested...
Apparently, there is a problem in VB.NET when a MDI child is set to windowstate.maximized whether set at design time or runtime. It doesn't play well when other MDI children are opened.

I am getting around this by not letting the user set any MDI children to maximized.

Code:
Private Sub frmMyForm_Resize(ByVal sender As Object, _
                ByVal e As System.EventArgs) _
                Handles MyBase.Resize

        If Me.WindowState = FormWindowState.Maximized Then
            Me.WindowState = FormWindowState.Normal
        End If

    End Sub

Users can resize a form with the resizer grabber (the double arrow) but cannot maximize.

If someone has a better solution I would be interested.

Rich
 
Hi Rich
I am not getting any problem if i set a MDI child is set to windowstate.maximized
Have u set the MDIForm as
IsMDIContainer=True
and how you instantiet MDI Child
IN MDI FORM
Dim mYForm As Form
mYForm = New Form2()
mYForm.MdiParent = Me
mYForm.Show()

Nouman
 
Thanks for the response nomi2000,
IsMDIContainer = True

And the child is called by [code}
Private Sub mnuToolsOptions_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles mnuToolsOptions.Click

Dim frmOptions As New frmOptions()
frmOptions.MdiParent = Me
frmOptions.Show()
End Sub
[/code]
 
You are still getting the problem?
or its fixed?
Nouman
 
Hey Nouman,

Yea, the problem still exists but I am calling it fixed with work-around I listed above. I'll look at it further when time permits.

Thanks

Rich
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top