Datagrid ToolTip

  • Thread starter Thread starter JerryP
  • Start date Start date
J

JerryP

Hi Group,

Id like to have a tooltip for each col in the datagrid.
Is there a way to do that ?

Thanks !

Jerry
 
Hi JerryP,

Is your application web based or winform?
I think Juan's link article tells you the way of adding tooltip for column
header in Web page. (Such as handle itemcreate event)
But in winform, there is no itemcreate event and the tooltip property is
also only for web control.

I think you should do the hit-test yourself in winform.
To get this down, you should handle in the mousemove event, and use
System.Windows.Forms.DataGrid.HitTestInfo to get the current columnheader
or cell.
Sample code like this:
//construct a tooltip in Form_load event
ToolTip toolTip1 = new ToolTip();
toolTip1.AutoPopDelay = 5000;
toolTip1.InitialDelay = 1000;
toolTip1.ReshowDelay = 500;
toolTip1.ShowAlways = true;

private void dataGrid1_MouseMove(object sender,
System.Windows.Forms.MouseEventArgs e)
{
System.Windows.Forms.DataGrid.HitTestInfo myHitTest;
myHitTest = dataGrid1.HitTest(e.X,e.Y);
if(myHitTest.Type==DataGrid.HitTestType.ColumnHeader)
{
string tooltiptext="ColumnHeader"+myHitTest.Column;
this.toolTip1.SetToolTip(this.dataGrid1, tooltiptext);
}
else
{
this.toolTip1.SetToolTip(this.dataGrid1, "");
}
}

This works well on my machine. If you still have any question, please feel
free to tell me.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| From: "JerryP" <[email protected]>
| Subject: Datagrid ToolTip
| Date: Fri, 17 Oct 2003 15:26:33 +0200
| Lines: 10
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| NNTP-Posting-Host: blueice1x.de.ibm.com 194.196.100.75
| Path:
cpmsftngxa06.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTNGXA05.phx.gbl!TK2MSFTNGP08
..phx.gbl!TK2MSFTNGP09.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:192060
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| Hi Group,
|
| Id like to have a tooltip for each col in the datagrid.
| Is there a way to do that ?
|
| Thanks !
|
| Jerry
|
|
|
 
Hi JerryP,

Does this resolved the problem?
If you still have anything unclear, please feel free to let me know, I am
glad to work with you.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| X-Tomcat-ID: 110105520
| References: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: (e-mail address removed) ("Jeffrey Tan[MSFT]")
| Organization: Microsoft
| Date: Mon, 20 Oct 2003 06:07:33 GMT
| Subject: RE: Datagrid ToolTip
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
| Message-ID: <Js#[email protected]>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| Lines: 59
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:192507
| NNTP-Posting-Host: TOMCATIMPORT1 10.201.218.122
|
|
| Hi JerryP,
|
| Is your application web based or winform?
| I think Juan's link article tells you the way of adding tooltip for
column
| header in Web page. (Such as handle itemcreate event)
| But in winform, there is no itemcreate event and the tooltip property is
| also only for web control.
|
| I think you should do the hit-test yourself in winform.
| To get this down, you should handle in the mousemove event, and use
| System.Windows.Forms.DataGrid.HitTestInfo to get the current columnheader
| or cell.
| Sample code like this:
| //construct a tooltip in Form_load event
| ToolTip toolTip1 = new ToolTip();
| toolTip1.AutoPopDelay = 5000;
| toolTip1.InitialDelay = 1000;
| toolTip1.ReshowDelay = 500;
| toolTip1.ShowAlways = true;
|
| private void dataGrid1_MouseMove(object sender,
| System.Windows.Forms.MouseEventArgs e)
| {
| System.Windows.Forms.DataGrid.HitTestInfo myHitTest;
| myHitTest = dataGrid1.HitTest(e.X,e.Y);
| if(myHitTest.Type==DataGrid.HitTestType.ColumnHeader)
| {
| string tooltiptext="ColumnHeader"+myHitTest.Column;
| this.toolTip1.SetToolTip(this.dataGrid1, tooltiptext);
| }
| else
| {
| this.toolTip1.SetToolTip(this.dataGrid1, "");
| }
| }
|
| This works well on my machine. If you still have any question, please
feel
| free to tell me.
|
| Best regards,
| Jeffrey Tan
| Microsoft Online Partner Support
| Get Secure! - www.microsoft.com/security
| This posting is provided "as is" with no warranties and confers no rights.
|
| --------------------
| | From: "JerryP" <[email protected]>
| | Subject: Datagrid ToolTip
| | Date: Fri, 17 Oct 2003 15:26:33 +0200
| | Lines: 10
| | X-Priority: 3
| | X-MSMail-Priority: Normal
| | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| | Message-ID: <[email protected]>
| | Newsgroups: microsoft.public.dotnet.languages.csharp
| | NNTP-Posting-Host: blueice1x.de.ibm.com 194.196.100.75
| | Path:
|
cpmsftngxa06.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTNGXA05.phx.gbl!TK2MSFTNGP08
| .phx.gbl!TK2MSFTNGP09.phx.gbl
| | Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.languages.csharp:192060
| | X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
| |
| | Hi Group,
| |
| | Id like to have a tooltip for each col in the datagrid.
| | Is there a way to do that ?
| |
| | Thanks !
| |
| | Jerry
| |
| |
| |
|
|
 
Jeffrey,

thanks for the support, yes it works now!

Jerry

"Jeffrey Tan[MSFT]" said:
Hi JerryP,

Does this resolved the problem?
If you still have anything unclear, please feel free to let me know, I am
glad to work with you.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| X-Tomcat-ID: 110105520
| References: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: (e-mail address removed) ("Jeffrey Tan[MSFT]")
| Organization: Microsoft
| Date: Mon, 20 Oct 2003 06:07:33 GMT
| Subject: RE: Datagrid ToolTip
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
| Message-ID: <Js#[email protected]>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| Lines: 59
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:192507
| NNTP-Posting-Host: TOMCATIMPORT1 10.201.218.122
|
|
| Hi JerryP,
|
| Is your application web based or winform?
| I think Juan's link article tells you the way of adding tooltip for
column
| header in Web page. (Such as handle itemcreate event)
| But in winform, there is no itemcreate event and the tooltip property is
| also only for web control.
|
| I think you should do the hit-test yourself in winform.
| To get this down, you should handle in the mousemove event, and use
| System.Windows.Forms.DataGrid.HitTestInfo to get the current columnheader
| or cell.
| Sample code like this:
| //construct a tooltip in Form_load event
| ToolTip toolTip1 = new ToolTip();
| toolTip1.AutoPopDelay = 5000;
| toolTip1.InitialDelay = 1000;
| toolTip1.ReshowDelay = 500;
| toolTip1.ShowAlways = true;
|
| private void dataGrid1_MouseMove(object sender,
| System.Windows.Forms.MouseEventArgs e)
| {
| System.Windows.Forms.DataGrid.HitTestInfo myHitTest;
| myHitTest = dataGrid1.HitTest(e.X,e.Y);
| if(myHitTest.Type==DataGrid.HitTestType.ColumnHeader)
| {
| string tooltiptext="ColumnHeader"+myHitTest.Column;
| this.toolTip1.SetToolTip(this.dataGrid1, tooltiptext);
| }
| else
| {
| this.toolTip1.SetToolTip(this.dataGrid1, "");
| }
| }
|
| This works well on my machine. If you still have any question, please
feel
| free to tell me.
|
| Best regards,
| Jeffrey Tan
| Microsoft Online Partner Support
| Get Secure! - www.microsoft.com/security
| This posting is provided "as is" with no warranties and confers no rights.
|
| --------------------
| | From: "JerryP" <[email protected]>
| | Subject: Datagrid ToolTip
| | Date: Fri, 17 Oct 2003 15:26:33 +0200
| | Lines: 10
| | X-Priority: 3
| | X-MSMail-Priority: Normal
| | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| | Message-ID: <[email protected]>
| | Newsgroups: microsoft.public.dotnet.languages.csharp
| | NNTP-Posting-Host: blueice1x.de.ibm.com 194.196.100.75
| | Path:
|
cpmsftngxa06.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTNGXA05.phx.gbl!TK2MSFTNGP08
| .phx.gbl!TK2MSFTNGP09.phx.gbl
| | Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.languages.csharp:192060
| | X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
| |
| | Hi Group,
| |
| | Id like to have a tooltip for each col in the datagrid.
| | Is there a way to do that ?
| |
| | Thanks !
| |
| | Jerry
| |
| |
| |
|
|
 
Back
Top