ToolTip 类 表示一个长方形的弹出式小窗口,该窗口在鼠标悬停在一个控件上时显示有关该控件用途的简短说明。 // This example assumes that the Form_Load event handling method // is connected to the Load event of the form. private void Form1_Load(object sender, System.EventArgs e) { // Create the ToolTip and associate with the Form container. ToolTip toolTip1 = new ToolTip(); // Set up the delays for the ToolTip. toolTip1.AutoPopDelay = 5000; toolTip1.InitialDelay = 1000; toolTip1.ReshowDelay = 500; // Force the ToolTip text to be displayed whether or not the form is active. toolTip1.ShowAlways = true;
// Set up the ToolTip text for the Button and Checkbox. toolTip1.SetToolTip(this.button1, "My button1"); toolTip1.SetToolTip(this.checkBox1, "My checkBox1"); }
表示一个长方形的弹出式小窗口,该窗口在鼠标悬停在一个控件上时显示有关该控件用途的简短说明。
// This example assumes that the Form_Load event handling method
// is connected to the Load event of the form.
private void Form1_Load(object sender, System.EventArgs e)
{
// Create the ToolTip and associate with the Form container.
ToolTip toolTip1 = new ToolTip(); // Set up the delays for the ToolTip.
toolTip1.AutoPopDelay = 5000;
toolTip1.InitialDelay = 1000;
toolTip1.ReshowDelay = 500;
// Force the ToolTip text to be displayed whether or not the form is active.
toolTip1.ShowAlways = true;
// Set up the ToolTip text for the Button and Checkbox.
toolTip1.SetToolTip(this.button1, "My button1");
toolTip1.SetToolTip(this.checkBox1, "My checkBox1");
}
toolTip2.SetToolTip(this.dataGridUser, this.dataGridUser[this.dataGridUser.CurrentCell.RowNumber,this.dataGridUser.CurrentCell.ColumnNumber].ToString());
我想实现的是 鼠标落上 显示有关该行的记录的一条信息(比如ID),请你继续,有了index后……
datagrid1.currentrowindex为当前行数,0为列索引
竟然说win form里dataGrid没有CurrentCellChanged事件
TOOLTIP具体包括在哪个类中
没有看见呀,是在哪个工具选项卡上?
在dataGrid的CurrentCellChanged事件中添加
toolTip2.SetToolTip(this.dataGridUser, this.dataGridUser[this.dataGridUser.CurrentCell.RowNumber,this.dataGridUser.CurrentCell.ColumnNumber].ToString());
工具箱->windows窗体 点右键->添加/删除项(I)...->.NET Fromeworke组件->将ToolTip选上
ok,看看工具箱上是不是有了ToolTip控件?
^_^