473,396 Members | 1,724 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Datagrid ToolTip

Hi Group,

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

Thanks !

Jerry
Nov 15 '05 #1
4 7519
> Id like to have a tooltip for each col in the datagrid.
Is there a way to do that ?


Check this out (watch for line wrap):
http://www.extremeexperts.com/Net/Co...ridHeader.aspx

That shows you how to do it in VB.Net, but it's basically the same code in
C#.

Hope that helps,
-JG
Nov 15 '05 #2

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.ColumnHead er)
{
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" <je***********@hotmail.com>
| 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: <u5**************@TK2MSFTNGP09.phx.gbl>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| NNTP-Posting-Host: blueice1x.de.ibm.com 194.196.100.75
| Path:
cpmsftngxa06.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTN GXA05.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
|
|
|

Nov 15 '05 #3

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: <u5**************@TK2MSFTNGP09.phx.gbl>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: v-*****@online.microsoft.com ("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**************@cpmsftngxa06.phx.gbl>
| 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.ColumnHead er)
| {
| 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" <je***********@hotmail.com>
| | 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: <u5**************@TK2MSFTNGP09.phx.gbl>
| | Newsgroups: microsoft.public.dotnet.languages.csharp
| | NNTP-Posting-Host: blueice1x.de.ibm.com 194.196.100.75
| | Path:
|
cpmsftngxa06.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTN GXA05.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
| |
| |
| |
|
|

Nov 15 '05 #4
Jeffrey,

thanks for the support, yes it works now!

Jerry

""Jeffrey Tan[MSFT]"" <v-*****@online.microsoft.com> wrote in message
news:7L**************@cpmsftngxa06.phx.gbl...

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: <u5**************@TK2MSFTNGP09.phx.gbl>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: v-*****@online.microsoft.com ("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**************@cpmsftngxa06.phx.gbl>
| 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.ColumnHead er)
| {
| 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" <je***********@hotmail.com>
| | 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: <u5**************@TK2MSFTNGP09.phx.gbl>
| | Newsgroups: microsoft.public.dotnet.languages.csharp
| | NNTP-Posting-Host: blueice1x.de.ibm.com 194.196.100.75
| | Path:
|
cpmsftngxa06.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTN GXA05.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
| |
| |
| |
|
|

Nov 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Stephen | last post by:
Is it possible to add a tooltip in the column of a Datagrid. Can someone please show me how I would do this for the datagrid column below. Thanks for any help anyone can give me. Here is the...
2
by: Stephen | last post by:
I'm trying to work with a datagrid column in order to display a tooltip in a datagrid cell. The reason I am doing this is because I have some long strings being returned and I don't want the rows...
2
by: Stevie_mac | last post by:
I'm probably missing something real easy here but... How do i set Tooltips to the header cells in a datagrid? Detail... Datagrid is databound, using non template named columns with 'Create...
1
by: Lars Netzel | last post by:
I need to have a Tooltip on each Cell in a datagrid, I don't know how to do this. I'm using Styles to the datagrid (Which I asume most people do since you never need to show all the fields from the...
2
by: Raed Sawalha | last post by:
Dear: I have DataGrid , which its task to (Edit, update, and delete) contents of XML File. the structure of XML like this <Info> <Name></Name> <Age></Age>
3
by: Craig G | last post by:
what way do you code it? i tried the following but it wouldnt display it lblAdd_info is a hidden field in the cell itself that contains the data i want to display in the tooltip text. i added the...
1
by: Gunjan Garg | last post by:
Hello All, I am working to create a generic datagrid which accepts a datasource(ListData - This is our own datatype) and depending on the calling program customizes itself for sorting,...
0
by: Luis Alonso | last post by:
Hi, I had created a web custom control to ask for user' confirmation on deleting and others process. I put the control in a vb file. The control is really simple: only an image button and a hidden...
0
by: rupalirane07 | last post by:
Both grids displays fine. But the problem is only parent datagrid sorting works fine but when i clik on child datagrid for sorting it gives me error: NullReferenceException error Any...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.