鼠标移到datagrid某行的某列时显示该列内容,我用的是第三方控件中的datagrid
解决方案 »
- 停靠控件 dockpanel 的父容器问题,默认父容器是窗体,如何设置其父容器????
- 如何打开excel模板
- C#如何调用系统的复制(Ctrl+C)和粘帖(Ctrl+V)
- C#:用户编辑数据时,当用户改动了表单数据后退出时如何提示用户保存?
- 如何用.net做报表
- 24点算法
- asp.net关于显示时间的问题
- foreach 怎样使用?
- 求教!!!如何实现c/s下的客户端的版本更新?我是用vs2013编写的,vs2013中有没有相应的解决方法??
- 为什么DataSet没有改变?
- Winfrom种 比如给一个panel设背景 目录怎么弄成活的啊 低手问题 请高手指点
- 对有密码的PDF文件,从IE打开时自动输入密码,客户看不见,但下载到本地需要密码
{
private int hitRow;
private int hitCol;
private System.Windows.Forms.ToolTip toolTip1;
public DataGridCellTips()
{
hitRow = -1;
hitCol = -1;
this.toolTip1 = new System.Windows.Forms.ToolTip();
this.toolTip1.InitialDelay = 200;
this.MouseMove += new MouseEventHandler(HandleMouseMove);
}
private void HandleMouseMove(object sender, MouseEventArgs e)
{
DataGrid.HitTestInfo hti = this.HitTest(new Point(e.X, e.Y));
if(hti.Type == DataGrid.HitTestType.Cell
&& ( hti.Row != hitRow || hti.Column != hitCol) )
{ //new hit row
hitRow = hti.Row;
hitCol = hti.Column;
if(this.toolTip1 != null && this.toolTip1.Active)
this.toolTip1.Active = false; //turn it off
this.toolTip1.SetToolTip(this, this[hitRow, hitCol].ToString());
this.toolTip1.Active = true; //make it active so it can show itself
//Console.WriteLine("MouseMove "+ hitRow.ToString() + " " + hitCol.ToString());
}
}
}
e.Item.Cells[0].Attributes.Add("title", "提示的内容");