急啊!!鼠标事件问题-鼠标移到datagrid某行的某列时显示该列内容 鼠标移到datagrid某行的某列时显示该列内容,我用的是第三方控件中的datagrid 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 呀的,你用的是第三方datagrid到底是什么嘛,不说出来谁能帮你 public class DataGridCellTips : DataGrid { 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()); } } } 我用的是ComponentArt datagrid这个控件 谢谢你啊,实现不了。我刚才忘说了,我是做web 在ItemDataBound事件里面e.Item.Cells[0].Attributes.Add("title", "提示的内容"); 我用的控件里面没有e.Item.Cells[0].Attributes.Add()这个阿 新人请教多层结构数据插入判断是否成功的问题 子线程中的WebBrowser,遍历标记出错 c# 和 ms sql 连接数问题 C#中异步调用和委托有什么区别呢? Hashtable和DataList 新手求教,请大家一定帮我!!!!!!!!! DataGrid更新数据库有问题 200分求答案 listview的拖放问题 怎样知道一个表有多少列或者说字段? 谁有VS。NET2003beta版 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", "提示的内容");