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 / April 2005

Tip: Looking for answers? Try searching our database.

How to make table inside datagrid resize?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Steve - 07 Apr 2005 15:11 GMT
I have form with datagrid control. I bind dataview object to datasource
property of the datagrid to populate it with data.

My question is how can I make columns and rows of the table inside datagrid
resize when form itself resizes. I set anchor property properly so datagrid
control itself DOES resize when I resize form, but table inside datagrid
control doesn't.

Can anyone give me a hint?

Thanks
Alex Passos - 07 Apr 2005 16:02 GMT
You will need to resize the columns in your table so that they take up all
available space.  Here is a nice article about doing auto-resizing to your
columns in a DataGrid:

http://odetocode.com/code/59.aspx

Alex

>I have form with datagrid control. I bind dataview object to datasource
> property of the datagrid to populate it with data.
[quoted text clipped - 9 lines]
>
> Thanks
Steve - 07 Apr 2005 17:31 GMT
Thank you for your tip.

Do you know how to hide the Datagird's Row Indicator (Triangle) which gets
displayed on the Row header, without hiding whole row header?

Thanks

> You will need to resize the columns in your table so that they take up all
> available space.  Here is a nice article about doing auto-resizing to your
[quoted text clipped - 17 lines]
> >
> > Thanks
Alex Passos - 07 Apr 2005 17:42 GMT
Try DataGrid.RowHeadersVisible = false;

Alex

> Thank you for your tip.
>
[quoted text clipped - 27 lines]
>> >
>> > Thanks
Steve - 07 Apr 2005 19:19 GMT
No, this won't work.
Setting this property to false will completely hide row headers.
I need to keep row headers but hide only Datagird's Row Indicator (Triangle).
Can you advise?

Thanks

> Try DataGrid.RowHeadersVisible = false;
>
[quoted text clipped - 31 lines]
> >> >
> >> > Thanks
Alex Passos - 07 Apr 2005 19:37 GMT
I don't know that there is a way to do that by looking up the Docs.  This
might be a really long shot but my next approach would be to intercept the
OnPaint event and do the following:

call the base to paint the control
determine if the selected cell is in the viewable area (docs for this exist
on MSDN).
if the cell is on the viewable area, get the row/col from current cell
using the cell location, find out where the rectangle that contains the
triangle (row indicator) is located (we know its in the same row and before
the first column).
Draw3drect probably can redraw over the indicator with the same color of the
grey cell.

Makes sense?

Yep, its complicated and will be time consuming.
> No, this won't work.
> Setting this property to false will completely hide row headers.
[quoted text clipped - 41 lines]
>> >> >
>> >> > Thanks

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.