Windows Forms TabControl tabpage tooltips

Answered Windows Forms TabControl tabpage tooltips

  • Thursday, July 05, 2012 10:07 AM
     
      Has Code

    I've a TabControl and have set something like this->tabPage1->ToolTipText = "myTabPage1"; this->tabPage2->ToolTipText = "myTabPage2"; Now the tooltip does not show if the tabcontrol is out of focus. I've tried using taccontrol->ShowAlways = true; but does not work. How do I make the tooltip work even when the tabcontrol is not in focus or the parent form is not in focus?

    Note: Other controls like buttons, checkboxes, comboboxes etc respond as expected even when the form is out of focus.




    • Edited by OrionWalli Thursday, July 05, 2012 10:08 AM
    • Edited by OrionWalli Thursday, July 05, 2012 11:37 AM
    • Edited by OrionWalli Thursday, July 05, 2012 7:06 PM
    •  

All Replies

  • Friday, July 06, 2012 7:00 AM
    Moderator
     
      Has Code

    Hi moawalling,

    There isn't a ShowAlways property of TabControl. For other controls, you can use SetToolTip method.  You can also set the ToolTip of the tab pages. However the textbox area of the tab page will show the ToolTip, not the header of the tab page.

    toolTip1->ShowAlways = true;
    toolTip1->SetToolTip(tabPage1, "text");

    The act of ToolTipText in the ToolPage is by default. If you really want to do this, I think you should create your own paint control.

    If there are any questions, please feel free to let me know.

    Best regards,


    Chester Hong
    MSDN Community Support | Feedback to us
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


  • Saturday, July 07, 2012 7:16 AM
     
     

    Hi Chester,

    Thanks for the reply. I am actually a newbie and would highly appreciate if you can give me a sample example or something like that for creating my own paint control.

  • Friday, July 13, 2012 10:16 AM
    Moderator
     
     Answered

    Hi OrionWalli,

    You can create a new control library project or add a User Control Item in your current project. I think you can create your Windows Forms control looks like the TabControl. For example, a control consists of some buttons and some panels.

    http://msdn.microsoft.com/en-us/library/ms235628(v=vs.100).aspx

    It is a simple way. However, it may not look well unless you do somthing in the Paint event.

    There is also an idea to put a TabControl and several transparent label on each TabPage. And set the labels' ToolTip instead the tabPages' ToolTipText. But I find it really not easy for me to set the label to transparent.

    I have tried the way mentioned in MSDN library about how to give control a transparent background, but it doesn't work for me:

    http://msdn.microsoft.com/en-us/library/wk5b13s4(v=vs.100).aspx

    Then I found an article, the first way is to set the control's parent property. But we cannot set the label's Parent to a TabControl. If set the parent to the TabPage, it seems to be not related to the tab headers. Second way is to use GDI+. That is not related to our issue. But there are some useful code snippet.

    http://www.codeproject.com/Articles/25048/How-to-Use-Transparent-Images-and-Labels-in-Window

    I have upload the project to skydrive, you can have a look at it. The project is using C# language.

    http://sdrv.ms/NS4Esd

    It seems that the control is a little hard coding. You can change the code if you would like to use it.

    Best regards,


    Chester Hong
    MSDN Community Support | Feedback to us
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked As Answer by OrionWalli Monday, July 16, 2012 8:01 PM
    •  
  • Monday, July 16, 2012 8:01 PM
     
     
    I got the solution now. Thanks a lot Chester for your help. Wonderful!