Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / July 2006

Tip: Looking for answers? Try searching our database.

Form initial display issue

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rod - 17 Jul 2006 17:00 GMT
I have a form display issue that surely others have encountered and
have resolved.  I couldn't find any posts about it, which I attribute
to my inability to describe it well.

I have an MDI application that opens every MDI child form maximized.
These child forms generally contain a DataGridView control with the
associated Binding Navigator at the top of the form.  The navigator is
anchored Top,Left, and the DataGridView is anchored to all sides.

When the form opens, the DataGridView does not fill the entire form,
rather there is a line about 1/2 inch from the bottom of the
application window.  If I resize the application window at all, the
deformity goes away and my form looks as it should.

How can I get my form to appear as it should when first displayed (with
the DataGridView filling up the whole form except for the Binding
Navigator)?

Thanks,
Rod Early
Pritcham - 18 Jul 2006 09:50 GMT
Hi

If, when you're designing the form, you add the BindingNavigator first,
set it's Dock property to "Top", then add your gridview, and set it's
Dock property to "Fill" it should be fine.

FYI, Anchoring is more about fixing the distance a control is from the
edges of a form/container (i.e. if you anchor a control to Top/Left
then the control should stay the same distance away from each of these
edges when you re-size the form).  Docking is more geared towards how
much space (and where) the control will take up in the form/container.
(In my mind anyway)

Hope that helps
Martin

> I have a form display issue that surely others have encountered and
> have resolved.  I couldn't find any posts about it, which I attribute
[quoted text clipped - 16 lines]
> Thanks,
> Rod Early
Rod - 18 Jul 2006 15:38 GMT
Martin:

I tried using the Doc property as you suggested but I still get the
same effect.  My controls don't look correct until I "resize" the
window.

Thanks,
Rod

> Hi
>
[quoted text clipped - 32 lines]
> > Thanks,
> > Rod Early
Pritcham - 18 Jul 2006 15:52 GMT
Hi

I'm not actually at a development machine at the moment so can't try to
recreate etc but it may be something to do with how you're opening up
your child windows (it shouldn't affect it but from what you've said,
any resizing will correct the issue so it kind of looks like it isn't
refreshing/painting the controls properly on load).  As a quick test,
have you tried adding a form.Refresh (or form.Repaint) call after the
child form has loaded? That may help (but as I can't test it I can't be
sure).

Cheers
Martin

> Martin:
>
[quoted text clipped - 41 lines]
> > > Thanks,
> > > Rod Early
Rod - 19 Jul 2006 15:13 GMT
Martin:

I have a solution, as follows:

1. Specify the WindowState property on the child form (window) to be
"Normal".
2. After instantiating the form, but before showing it, set its
WindowState to Maximized.
3. Show the form.  The controls (such as datagrids) have expanded to
their maximized positions, as I expected.

To reiterate, I had to change the WindowState from Normal to Maximized
before showing it -- presumably the change of state caused the
application to put everything it its proper place.

Thanks,
Rod

> Hi
>
[quoted text clipped - 55 lines]
> > > > Thanks,
> > > > Rod Early
Pritcham - 19 Jul 2006 15:58 GMT
Glad you got it sorted Rod - bit of a nuisance having to do that but
hey - if it gets the job done...!

Cheers
Martin
> Martin:
>
[quoted text clipped - 73 lines]
> > > > > Thanks,
> > > > > Rod Early

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.