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 / February 2007

Tip: Looking for answers? Try searching our database.

user control with a datagrid control in it

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
David C - 01 Feb 2007 21:52 GMT
I have a user control with a datagrid in it.

Here is what I would like to do

* As the width of the datagrid grows or shrinks, have the user control
adjust so that it always looks full in the user control with no
scrolls.  The datagrid's columns can be hidden or shown at run time,
so I cannot predict what the width will be until runtime.

* Also have that user control always centered.

In other words, I am trying to emulate how user controls behave on the
Web.  Thank you.
Ciaran O''Donnell - 02 Feb 2007 09:35 GMT
First the first one, you would need to set the Usercontrol properties in the
usercotnrol designer to autosize=true, and AutoSizeMode = GrowAndShrink.
Then handle the columns added, columns removed, columnresized events on the
datagridview and set the size of the grid to the PrefferedSize property. That
is the size it would be to have no scroll bars.

For always centred. Centre it in the designer (theres a toolbar item for
that), then change the Anchor to be top (no left or right) and it will stay
in the centre,

HTH
Signature

Ciaran O''Donnell
http://wannabedeveloper.spaces.live.com

> I have a user control with a datagrid in it.
>
[quoted text clipped - 9 lines]
> In other words, I am trying to emulate how user controls behave on the
> Web.  Thank you.

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.