I have a inherited button which I use in a Winform application that uses a tooltip control. All is good with the tooltip, but it appears that the base class button in showing a tooltip along with the parent. I would like to disable the base class button from showing it's tooltip while preserving the tooltip for the parent. I wanted to post the picture showing the dual tooltip, but too much a nubie here, I am sure your imagination see what is see...if not let the force guide you.
using System;
using System.ComponentModel;
using System.Windows.Forms;
namespace GUI
{
public partial class ToggleButton : Button
{
private Button button;
[Category("Behavior")]
[Description("Gets or sets the botton state")]
[DefaultValue(true)]
public bool State { get; set; }
[Category("Behavior")]
[Description("Gets or sets the TRUE state text")]
public string TrueText { get; set; }
[Category("Behavior")]
[Description("Gets or sets the FALSE state text")]
public string FalseText { get; set; }
public ToggleButton() : base(){}
private void InitializeComponent()
{
this.button = new System.Windows.Forms.Button();
this.SuspendLayout();
this.button.Location = new System.Drawing.Point(0, 0);
this.button.Name = "button";
this.button.Size = new System.Drawing.Size(75, 23);
this.button.TabIndex = 0;
this.button.Text = "button";
this.button.UseVisualStyleBackColor = true;
this.button.Click += new System.EventHandler(this.button2_Click);
this.ResumeLayout(false);
}
private void button2_Click(object sender, EventArgs e)
{
Button clickedButton = (Button)sender;
State = !State;
clickedButton.Text = State ? TrueText : FalseText;
}
}
}
Aucun commentaire:
Enregistrer un commentaire