Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
150
Custom tooltip
posted

I want to use the Infragistics tooltips, since they offer more appearance customisation than the standard System.Windows.Forms.ToolTip. However, I am experiencing difficulties getting them to display at all.

 I have tried two methods. I’ll explain them below. This code is in my grid class, which extends UltraGrid.

 

1. Using UltraTooltipManager

 

private UltraToolTipInfo tooltip;

private UltraToolTipManager m_toolTipManager;

 

private void SetupToolTip()

{

      m_toolTipManager = new UltraToolTipManager();

           

      m_tooltip = new UltraToolTipInfo();

      m_tooltip.Appearance.FontData.Name = "Verdana";

      m_tooltip.ToolTipTitleAppearance.FontData.Name = "Verdana";

      m_tooltip.Enabled = DefaultableBoolean.True;           

}

 

...

 

public void ShowToolTip(string titleText_, string text_)

{

      m_tooltip.ToolTipText = text_;

      m_tooltip.ToolTipTitle = titleText_;

      m_toolTipManager.SetUltraToolTip(this, m_tooltip);

      Point loc = Cursor.Position;

      loc.Offset(16, 16);

      m_toolTipManager.ShowToolTip(this, loc);

}

 

2. Using Infragistics.Win.ToolTip

private Infragistics.Win.ToolTip m_tooltip;

private void SetupToolTip()

{

      m_tooltip = new Infragistics.Win.ToolTip(this);

      m_tooltip.TitleFont = NinePointRegularVerdanaFont.GetFont();

      m_tooltip.Font = NinePointBoldVerdanaFont.GetFont();

      m_tooltip.TopMost = true;

}

 

...


public void ShowToolTip(string titleText_, string text_)

{

      m_tooltip.ToolTipTitle = titleText_;

      m_tooltip.ToolTipText = text_;

      Point loc = Cursor.Position;

      loc.Offset(16, 16);

      m_tooltip.Show(loc);       

}
 

In both of these implementations, whenever I call ShowTooltip the tooltip just doesn’t appear. Using System.Windows.Forms.ToolTip I simply call the Show method and it works fine.

 

I’m stuck as to why neither of the above methods work. Does anyone have any insights?

Parents
No Data
Reply
  • 37774
    posted

    For your first approach, I don't think that you need to specifically call ShowToolTip if you've called SetUltraToolTip; however, given that it seems like you want precise control over showing the ToolTip, you can probably skip the SetUltraToolTip method yourself (as you likely don't need the manager since you're doing the work yourself).

    As for your second approach, nothing seems wrong here.  I tried this same approach using a derived .NET Button along with the Infragistics.Win.ToolTip object and the same code as you (except for the custom gets of the font) and they worked fine.  I'm not sure how that method could screw this up either; have you tried this with "this.Font" just as a test?  Are you sure that the cursor is on the screen?  You could try "m_tooltip.Show(this.Parent.PointToScreen(this.Location));" just as a test for that aspect.

    -Matt

Children