1、如何设置控件(比如按钮、编辑框)的tips?也就是鼠标停留时自动显示的黄色小帮助?2、ListView控件设置了checkedBox,也就是每行前面有checkedBox,我想有些行去掉这个checkBox(去不掉disable变灰也可以),有些行又保留,该怎么做?

解决方案 »

  1.   

    1.ToolTip 属性 2. 在该空间的基础上没有办法, 有时间可以自己琢磨一个。
      

  2.   

    第一个问题:用ToolTip控件.比如给label1加tips
    this.toolTip1.SetToolTip(this.label1,"哈哈");第二个问题等想到了回答你.
      

  3.   

    ToolTip类:表示一个长方形的弹出式小窗口,该窗口在鼠标悬停在一个控件上时显示有关该控件用途的简短说明。
    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");
    }
      

  4.   

    第一个问题是ToolTip控件,上面说的很清楚了。
    第二个问题是有点复杂,你可以使用Infragistic的NetAdvantage的控件库找找看。
    要么就是自己写个这样的控件。其WinGrid的功能非常强大。
      

  5.   

    this.tooltip.settooltip(this.控件名,"aaa");
      

  6.   

    第二个基本上比较难,继承一下listview,和listviewitem,自己重写个吧