1

How can I show Tooltip text on my own TabPages extends from TabPages just added some extra variables and using DrawItem event.

I've generate them in method.

ISIMtabPage newTab = new ISIMtabPage();

// setting up newTab
string contactName = getContactName(object);

chatFormTabs.TabPages.Add(newTab);

toolTip1.SetToolTip((ISIMtabPage)chatFormTabs.TabPages[chatId], contactName);

But if I hover on the tab it doesn't do anything.

I've TabControl.ShowToolTips enabled.

What should I do?

Thanks in advance.

2 Answers 2

1

I would check toolTip1.SetToolTip

example for Tooltip use:

using System.Drawing;
using System.Windows.Forms;

public class Form1 : Form
{
    private TabControl tabControl1;
    private TabPage tabPage1;
    private TabPage tabPage2;

    private void MyTabs()
    {
        this.tabControl1 = new TabControl();
        this.tabPage1 = new TabPage();
        this.tabPage2 = new TabPage();

        this.tabControl1.Controls.AddRange(new Control[] {
            this.tabPage1,
            this.tabPage2});
        this.tabControl1.Location = new Point(35, 25);
        this.tabControl1.Size = new Size(220, 220);

        // Shows ToolTipText when the mouse passes over tabs. 
        this.tabControl1.ShowToolTips = true;

        // Assigns string values to ToolTipText. 
        this.tabPage1.ToolTipText = "myTabPage1";
        this.tabPage2.ToolTipText = "myTabPage2";

        this.Size = new Size(300, 300);
        this.Controls.AddRange(new Control[] {
            this.tabControl1});
    }

    public Form1()
    {
        MyTabs();
    }

    static void Main() 
    {
        Application.Run(new Form1());
    }
}
Sign up to request clarification or add additional context in comments.

3 Comments

I see. Then whats the difference between control.ToolTipText and toolTip1.SetToolTip(control, text) If I can use that control property without using toolTip control?
maybe your tooltip is out of scope? you can also look here
or here
1

Actually kinda tricky, so make sure that from the tabControl1 properties "ShowToolTips" is True.

  1. the form1 has a tooltip1 and a TabControl named tabControl1 with multiple tabs for testing

  2. tabControl1 has a collection of tabs

  3. edit the collection and set the tab you want to have the tooltip "ToolTip on toolTip" and ToolTipText to "your message here"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.