【问题标题】:Display tooltip only when text in Infragistics' UltraCombo is too long仅在 Infragistics 的 UltraCombo 中的文本太长时显示工具提示
【发布时间】:2014-04-30 09:22:37
【问题描述】:

我们在 WinForms 应用程序中使用 Infragistics 的 UltraCombo。

有时显示的文本(在组合框本身中,即未展开时)太长而无法完全显示。

有没有办法只在此文本被截断时提供工具提示,而在显示的文本完全适合 UltraCombo 组合框时不显示工具提示?

非常感谢...

【问题讨论】:

    标签: winforms combobox infragistics ultracombo


    【解决方案1】:

    我知道的唯一方法是手动确定当前文本是否太宽。

    向表单添加工具提示。然后处理组合框上的 TextChanging 事件。

    private void ultraCombo1_TextChanged( object sender, EventArgs e )
    {
        var textWidth = TextRenderer.MeasureText( ultraCombo1.Text, ultraCombo1.Font ).Width;
        var textBoxWidth = ultraCombo1.ClientRectangle.Width - SystemInformation.VerticalScrollBarWidth;
        if ( textWidth < textBoxWidth )
            toolTip1.SetToolTip( ultraCombo1, "" );
        else
            toolTip1.SetToolTip( ultraCombo1, ultraCombo1.Text);
    }
    

    【讨论】:

      猜你喜欢
      • 2011-05-19
      • 2013-09-02
      • 2014-03-04
      • 1970-01-01
      • 2021-09-10
      • 2011-09-14
      • 2018-10-24
      • 1970-01-01
      • 2012-07-17
      相关资源
      最近更新 更多