|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
MDI Form loadingI am using the following to load my mdi form into the parent.
If Me.frmIncoming Is Nothing Then Me.frmIncoming = New IncomingForm Me.frmIncoming.MdiParent = Me End If Me.frmIncoming.Show() Me.frmIncoming.Location = New Point(10, 450) When the forms Show() method is called and before the location is changed the form briefly appears at the default child MDI location before moving. This looks terrible on screen as a user. Is there a way of overriding the show method so it won't preposition the form? I have tried placing the location before the Show() method but that doesn't work.
Show quote
Hide quote
On 29 Jun 2006 13:05:49 -0700, "Charlie Brown" <cbr***@duclaw.com> You need to change the StartUpPosition from WindowsDefault to Manual.wrote: >I am using the following to load my mdi form into the parent. > > If Me.frmIncoming Is Nothing Then > Me.frmIncoming = New IncomingForm > Me.frmIncoming.MdiParent = Me > End If > Me.frmIncoming.Show() > Me.frmIncoming.Location = New Point(10, 450) > >When the forms Show() method is called and before the location is >changed the form briefly appears at the default child MDI location >before moving. This looks terrible on screen as a user. Is there a >way of overriding the show method so it won't preposition the form? I >have tried placing the location before the Show() method but that >doesn't work. I would avoid naming an instance of a form with same name as the original form. Dim ChildForm As New IncomingForm ChildForm.MdiParent = Me ChildForm.StartPosition = FormStartPosition.Manual ChildForm.Location = New Drawing.Point(50, 50) ChildForm.Show() Thanks Gene, that gets me a little further. Now the form starts in the
correct position, however the border shows for a brief second before disappearing. I do not want a border on the form. Basically what it looks like to the user is a windows form flashes and then goes away. Can I somehow get rid of this? gene kelley wrote: Show quoteHide quote > On 29 Jun 2006 13:05:49 -0700, "Charlie Brown" <cbr***@duclaw.com> > wrote: > > >I am using the following to load my mdi form into the parent. > > > > If Me.frmIncoming Is Nothing Then > > Me.frmIncoming = New IncomingForm > > Me.frmIncoming.MdiParent = Me > > End If > > Me.frmIncoming.Show() > > Me.frmIncoming.Location = New Point(10, 450) > > > >When the forms Show() method is called and before the location is > >changed the form briefly appears at the default child MDI location > >before moving. This looks terrible on screen as a user. Is there a > >way of overriding the show method so it won't preposition the form? I > >have tried placing the location before the Show() method but that > >doesn't work. > You need to change the StartUpPosition from WindowsDefault to Manual. > > I would avoid naming an instance of a form with same name as the > original form. > > Dim ChildForm As New IncomingForm > ChildForm.MdiParent = Me > ChildForm.StartPosition = FormStartPosition.Manual > ChildForm.Location = New Drawing.Point(50, 50) > ChildForm.Show() On 29 Jun 2006 15:36:22 -0700, "Charlie Brown" <cbr***@duclaw.com> Do you mean border of the child form at the default position flasheswrote: >Thanks Gene, that gets me a little further. Now the form starts in the >correct position, however the border shows for a brief second before >disappearing. I do not want a border on the form. Basically what it >looks like to the user is a windows form flashes and then goes away. >Can I somehow get rid of this before it actually displays in the correct position? Opening a new MDI project here with a MDI Parent form, a form named IncomingForm, and only the sample code I had in a click event, I do no see what you describe. The child form displays as expected. I have, however, run across that flashing business under other circumstances. It usually has to do with some piece of code that is executing and causing the form's visibility to change before the form should be shown. One notorious example is trying to change the WindowState to Maximized before the forms is shown. What you get is a form border at Normal size and then a flash up to Maximized when the form finishes loading. 1) Try stepping through the code starting at: Dim ChildForm As New IncomingForm (or whatever you are using) and see if you can detect where the ChildForm might be showing before it should. 2) Try Starting a new MDI test project as I described and then adding bits of code from your original IncomingForm and see if you can determine where the flashing is occurring. Gene Show quoteHide quote >gene kelley wrote: >> On 29 Jun 2006 13:05:49 -0700, "Charlie Brown" <cbr***@duclaw.com> >> wrote: >> >> >I am using the following to load my mdi form into the parent. >> > >> > If Me.frmIncoming Is Nothing Then >> > Me.frmIncoming = New IncomingForm >> > Me.frmIncoming.MdiParent = Me >> > End If >> > Me.frmIncoming.Show() >> > Me.frmIncoming.Location = New Point(10, 450) >> > >> >When the forms Show() method is called and before the location is >> >changed the form briefly appears at the default child MDI location >> >before moving. This looks terrible on screen as a user. Is there a >> >way of overriding the show method so it won't preposition the form? I >> >have tried placing the location before the Show() method but that >> >doesn't work. >> You need to change the StartUpPosition from WindowsDefault to Manual. >> >> I would avoid naming an instance of a form with same name as the >> original form. >> >> Dim ChildForm As New IncomingForm >> ChildForm.MdiParent = Me >> ChildForm.StartPosition = FormStartPosition.Manual >> ChildForm.Location = New Drawing.Point(50, 50) >> ChildForm.Show() I started a new project with 2 forms. Set form 1 to MDI parent and
added a button with the following code in the click event. Form2 is set to no form border. Dim ChildForm as New Form2 ChildForm.MdiParent = Me ChildForm.StartPosition = FormStartPosition.Manual ChildForm.Show() ChildForm.Location = New Point(100, 100) When you click the button it will create the second form, which for a split second will appear with a border, then move to it's proper location at 100,100. gene kelley wrote: Show quoteHide quote > On 29 Jun 2006 15:36:22 -0700, "Charlie Brown" <cbr***@duclaw.com> > wrote: > > >Thanks Gene, that gets me a little further. Now the form starts in the > >correct position, however the border shows for a brief second before > >disappearing. I do not want a border on the form. Basically what it > >looks like to the user is a windows form flashes and then goes away. > >Can I somehow get rid of this > > > Do you mean border of the child form at the default position flashes > before it actually displays in the correct position? Opening a new > MDI project here with a MDI Parent form, a form named IncomingForm, > and only the sample code I had in a click event, I do no see what you > describe. The child form displays as expected. > > I have, however, run across that flashing business under other > circumstances. It usually has to do with some piece of code that is > executing and causing the form's visibility to change before the form > should be shown. One notorious example is trying to change the > WindowState to Maximized before the forms is shown. What you get is a > form border at Normal size and then a flash up to Maximized when the > form finishes loading. > > 1) Try stepping through the code starting at: > Dim ChildForm As New IncomingForm (or whatever you are using) > and see if you can detect where the ChildForm might be showing before > it should. > > 2) Try Starting a new MDI test project as I described and then adding > bits of code from your original IncomingForm and see if you can > determine where the flashing is occurring. > > Gene > > > > >gene kelley wrote: > >> On 29 Jun 2006 13:05:49 -0700, "Charlie Brown" <cbr***@duclaw.com> > >> wrote: > >> > >> >I am using the following to load my mdi form into the parent. > >> > > >> > If Me.frmIncoming Is Nothing Then > >> > Me.frmIncoming = New IncomingForm > >> > Me.frmIncoming.MdiParent = Me > >> > End If > >> > Me.frmIncoming.Show() > >> > Me.frmIncoming.Location = New Point(10, 450) > >> > > >> >When the forms Show() method is called and before the location is > >> >changed the form briefly appears at the default child MDI location > >> >before moving. This looks terrible on screen as a user. Is there a > >> >way of overriding the show method so it won't preposition the form? I > >> >have tried placing the location before the Show() method but that > >> >doesn't work. > >> You need to change the StartUpPosition from WindowsDefault to Manual. > >> > >> I would avoid naming an instance of a form with same name as the > >> original form. > >> > >> Dim ChildForm As New IncomingForm > >> ChildForm.MdiParent = Me > >> ChildForm.StartPosition = FormStartPosition.Manual > >> ChildForm.Location = New Drawing.Point(50, 50) > >> ChildForm.Show() On 30 Jun 2006 08:59:34 -0700, "Charlie Brown" <cbr***@duclaw.com> The above code will "flash" as you are moving the form after it iswrote: >Dim ChildForm as New Form2 >ChildForm.MdiParent = Me >ChildForm.StartPosition = FormStartPosition.Manual >ChildForm.Show() >ChildForm.Location = New Point(100, 100) shown. Try this: Dim ChildForm As New Form2 ChildForm.MdiParent = Me ChildForm.StartPosition = FormStartPosition.Manual ChildForm.Location = New Point(100, 100) ChildForm.Show() Gene
ActiveX.exe and RaiseEvent
need help with a string manipulation. Late Binding Return Value Weirdness Hindi numbers in Graphics class Threads do not Terminate! OpenFileDialog Handle Leak read textbox into array - vb2005 DataGridView Question - VB.NET 2005 determine which radiobutton in a groupbox is checked? Browsing Records |
|||||||||||||||||||||||