TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
wayne singh
NA
4
0
DataGrid Width Issue - Please Explain!
Jul 31 2006 2:02 AM
Hi All, I am writing a generic multitable maintenance screen. I have a SplitContainer with a DataGrid in each. This all works fine, however when I go to set the width I get some really bizare results: When I set it manually all is good:
private void SetGridSizeAndLocation()
{
this.splitContainer1.SuspendLayout();
if (_horizontalSplit)
{
this.splitContainer1.Orientation = Orientation.Horizontal;
this.splitContainer1.SplitterDistance = (this.splitContainer1.Height / 2);
}
else
{
this.splitContainer1.Orientation = Orientation.Vertical;
this.splitContainer1.SplitterDistance = (this.splitContainer1.Width / 2);
}
int width = this.splitContainer1.Panel1.Width - 5;
_parentGrid.Size = new Size(390, 100);
_parentGrid.Refresh();
_childGrid.Size = new Size(390, 100);
_childGrid.Refresh();
this.splitContainer1.ResumeLayout();
}
IMAGE:
http://img154.imageshack.us/img154/7311/1stfs0.png
However if I try to set the width dynamically I get this:
[quote]private void SetGridSizeAndLocation()
{
this.splitContainer1.SuspendLayout();
if (_horizontalSplit)
{
this.splitContainer1.Orientation = Orientation.Horizontal;
this.splitContainer1.SplitterDistance = (this.splitContainer1.Height / 2);
}
else
{
this.splitContainer1.Orientation = Orientation.Vertical;
this.splitContainer1.SplitterDistance = (this.splitContainer1.Width / 2);
}
int width = this.splitContainer1.Panel1.Width - 5;
_parentGrid.Size = new Size(width, 100);
_parentGrid.Refresh();
width = this.splitContainer1.Panel2.Width - 5;
_childGrid.Size = new Size(width, 100);
_childGrid.Refresh();
this.splitContainer1.ResumeLayout();
}
IMAGE:
http://img144.imageshack.us/img144/3523/2ndre6.png
Any ideas woudl really be appreciated. Thank you in advance, Cya.
Reply
Answers (
0
)
Constants in C#
How to change the particular row color of grid in VB.NET