How to add Tooltip for a disabled button but not through any Mouse Events
Please let me know , how to add tooltip for a disabled button
Please let me know , how to add tooltip for a disabled button
@KarthikeyanRamalingam-6696
May I know if you have got any chance to check my reply?
If it doesn't suit your situation or you have any new ideas, please feel free to raise them and we can have more discussions.
Please refer to the following code to enable tooltip for the disabled button:
bool IsShown = false;
private void Form1_Load(object sender, System.EventArgs e)
{
toolTip1.AutoPopDelay = 5000;
toolTip1.InitialDelay = 1000;
toolTip1.ReshowDelay = 500;
toolTip1.ShowAlways = true;
toolTip1.SetToolTip(this.button1, "test button");
}
void Form1_MouseMove(object sender, MouseEventArgs e)
{
Control ctrl = this.GetChildAtPoint(e.Location);
if (ctrl != null)
{
if (ctrl == this.button1 && !IsShown)
{
string tipstring = this.toolTip1.GetToolTip(this.button1);
this.toolTip1.Show(tipstring, this.button1, this.button1.Width / 2, this.button1.Height / 2);
IsShown = true;
}
}
else
{
this.toolTip1.Hide(this.button1);
IsShown = false;
}
}
private void button1_Click(object sender, EventArgs e)
{
button1.Enabled = false;
}
I haven't found a way to do it without any Mouse events. It seems that Mouse_Move is necessary.
If it were in WPF, it would be simpler.
<Button x:Name="button" ToolTipService.ShowOnDisabled="True" Content="Button"/>
Problem displaying tooltip over a disabled control
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
8 people are following this question.
Insert a node as child ,before or after a node in nested dynamic JSON Node using C#
Visual Studio 2019: Undefined behavior in a C++/CLI wrapper project.
Example for how to get Package Metadata from Azure DevOps Rest-Api Artifacts using c#
How to collapse individual nested grids/stackpanels inside a grid?