Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Datagrid Header row height

1 view
Skip to first unread message

Charles Young

unread,
May 20, 2003, 5:44:14 PM5/20/03
to
I am writing a .NET VB Windows Form with a datagrid that
must duplicate an old legacy system. The old screen has
a datagrid with a header that is two lines high. A
column header would look like this:
Company
Name

I can find no way to increase the height of my .Net Form
datagrid header or put two lines in the column header.
Anyone know how to do this?

Charles

Lion Shi

unread,
May 21, 2003, 12:06:59 PM5/21/03
to
Hello Charles,

I thimk adding the GridTableStyle to the style collection will do help.
Here is a sample code:

private void Form1_Load(object sender, System.EventArgs e)
{
DataGridTableStyle myGridTableStyle = new DataGridTableStyle();
myGridTableStyle.MappingName = dataSet1.Tables[0].TableName;
dataGrid1.TableStyles.Add(myGridTableStyle);

dataGrid1.TableStyles[0].PreferredRowHeight = 250;
foreach(DataGridColumnStyle colStyle in
dataGrid1.TableStyles[0].GridColumnStyles )
{
try
{
colStyle.HeaderText =dataSet1.Tables[0].Columns[0].Caption + "Some
othertitle part";
} catch( System.Exception exc) { break;}
}
}

I hope this is helpful.

Best regards,

Lion Shi [MSFT]
MCSE, MCSD
Microsoft Support Engineer

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. 2003 Microsoft Corporation. All rights
reserved.
--------------------
> Content-Class: urn:content-classes:message
> From: "Charles Young" <Charle...@fhr.com>
> Sender: "Charles Young" <Charle...@fhr.com>
> Subject: Datagrid Header row height
> Date: Tue, 20 May 2003 14:44:14 -0700
> Lines: 13
> Message-ID: <055501c31f18$f4ff15e0$a301...@phx.gbl>
> MIME-Version: 1.0
> Content-Type: text/plain;
> charset="iso-8859-1"
> Content-Transfer-Encoding: 7bit
> X-Newsreader: Microsoft CDO for Windows 2000
> Thread-Index: AcMfGPT/IoVEKgGCQdSw9RsfEVH9ow==
> X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
> Newsgroups: microsoft.public.dotnet.framework.windowsforms
> Path: cpmsftngxa06.phx.gbl
> Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.windowsforms:45068
> NNTP-Posting-Host: TK2MSFTNGXA11 10.40.1.163
> X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms

Charles Young

unread,
May 21, 2003, 4:53:09 PM5/21/03
to

Thanks for the reply Lion.

I tried the DataGridTableStyle and setting the PreferredRowHeight, but
this only affects the height of the data rows, not the column header row
(titles). Even if it did, you are just appending the "some other title
part" onto the end of the column header name, there is nothing that
forces it to wrap around to appear on the second header line, if there
was one.

Charles

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Lion Shi

unread,
May 21, 2003, 9:58:51 PM5/21/03
to
Hello Charles,

Sorry for misunderstanding your problem. If you want to change column
header height, I am afraid there is no easy way to do that with the
DataGrid control of .NET Class Library. You may have a try of some third
party controls available that allow multiple line column headers.
ComponentOne's TrueDBGrid (http://www.componentone.com) and Syncfusion's
Essential Grid (http://www.syncfusion.com) to name a couple.

I hope this helps.

Best regards,

Lion Shi [MSFT]
MCSE, MCSD
Microsoft Support Engineer

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. 2003 Microsoft Corporation. All rights
reserved.
--------------------

> From: Charles Young <anon...@devdex.com>
> References: <0nh7LM7H...@cpmsftngxa06.phx.gbl>
> X-Newsreader: AspNNTP 1.50 (ActionJackson.com)
> Subject: RE: Datagrid Header row height
> Mime-Version: 1.0
> Content-Type: text/plain; charset="us-ascii"
> Content-Transfer-Encoding: 7bit
> Message-ID: <u1EQ9r9H...@TK2MSFTNGP11.phx.gbl>
> Newsgroups: microsoft.public.dotnet.framework.windowsforms
> Date: Wed, 21 May 2003 13:53:09 -0700
> NNTP-Posting-Host: actionjackson133.dsl.frii.net 216.17.147.133
> Lines: 1
> Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11.phx.gbl
> Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.windowsforms:45149
> X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms

0 new messages