1、如何设置控件(比如按钮、编辑框)的tips?也就是鼠标停留时自动显示的黄色小帮助?2、ListView控件设置了checkedBox,也就是每行前面有checkedBox,我想有些行去掉这个checkBox(去不掉disable变灰也可以),有些行又保留,该怎么做?
解决方案 »
- 关于改变DataGridView的行背景色(WinForm)
- 用反射深度复制只有公用成员变量
- 菜鸟求助:请问一下,我写了一个事件,有谁知道这个事件该传什么参数呀??
- 一个简单的binaryReader问题,为什么程序会崩溃,不明,麻烦大家了
- 怎么把richbox中的数据传到webservice上?
- Excel转PDF问题
- asp.net基于角色的权限验证时,可否不要cookie而用session???
- 现在还流行orm吗?
- 请问在Web应用里如何知道浏览器当前的本地时间?
- c#生成安装程序中的问题
- c# windows 编程问题(刚才问过了,是不是没人会)
- 用PropertyGrid为树的每个点设属性后,到下一页如何获取其值?
this.toolTip1.SetToolTip(this.label1,"哈哈");第二个问题等想到了回答你.
ToolTip 类让您在用户将鼠标悬停在控件上时为用户提供帮助。ToolTip 类通常用来向用户提示控件的预期用途。例如,可以为接受名称的 TextBox 控件指定工具提示文本,同时指定要键入到控件中的名称格式。除了提供帮助外,还可使用 ToolTip 类提供运行时状态信息。例如,当用户在显示 Internet 连接状态的 PictureBox 控件上移动鼠标光标时,可以使用 ToolTip 类显示连接速度和行质量数据。ToolTip 类提供的属性可让您修改“工具提示”窗口显示的时间长短和速度。AutoPopDelay 确定“工具提示”窗口显示的时间长短;InitialDelay 和 ReshowDelay 两个属性则确定显示“工具提示”窗口之前的延迟。若要将所有这些属性设置为一致的模式,可使用 AutomaticDelay 属性。然后使用此值计算和设置其他延迟属性的值。如果不管是启用了 Form 还是启用了包含控件的容器,都要使控件的工具提示文本能够显示,您可以使用 ShowAlways 属性。若要在您的应用程序中禁止显示所有工具提示文本,则可以使用 Active 属性。ToolTip 类可在任何容器内使用。若要指定在特定的容器内使用 ToolTip 类,请使用 ToolTip 构造函数。为了使用户在控件上移动鼠标光标时显示工具提示文本,要显示的工具提示文本必须与 ToolTip 类的某个实例内的控件相关联。若要将工具提示文本与一个控件关联,请使用 SetToolTip 方法。可以为同一控件多次调用 SetToolTip 方法来更改与控件关联的文本。如果要获取与控件关联的文本,请使用 GetToolTip 方法。若要移除 ToolTip 类的某个实例的所有工具提示文本关联,请使用 RemoveAll 方法。 下面的示例创建一个 ToolTip 类的实例,并将它与在其中创建该实例的 Form 关联。代码随后初始化延迟属性 AutoPopDelay、InitialDelay 和 ReshowDelay。另外,ToolTip 类的实例将 ShowAlways 属性设置为 true,以使工具提示文本始终显示而不管窗体是否活动。最后,该示例将工具提示文本与窗体上的 Button 和 CheckBox 这两个控件关联。本示例假定示例中定义的方法位于 Form 中,该窗体包含名为 button1 的 Button 控件和名为 checkBox1 的 CheckBox 控件,并且假定该方法是从 Form 的构造函数中调用的。[Visual Basic]
' This example assumes that the Form_Load event handling method
' is connected to the Load event of the form.
Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles MyBase.Load
' Create the ToolTip and associate with the Form container.
Dim toolTip1 As 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(Me.button1, "My button1")
toolTip1.SetToolTip(Me.checkBox1, "My checkBox1")
End Sub[C#]
// 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");
}
第二个问题是有点复杂,你可以使用Infragistic的NetAdvantage的控件库找找看。
要么就是自己写个这样的控件。其WinGrid的功能非常强大。