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
530
Measuring the text entry portion of UltraCombo
posted

Is there a way to measure the portion of the UltraCombo where the text actually is? Or maybe the measuring the drop down button and its position inside the control?

What I'm trying to do is see if the text in the combo box is too big and does not fit in the control, then to show a tooltip. I've read about the UltraComboEditor control, but I can't use this control.

Any suggestions? Thanks

Parents
  • 469350
    Offline posted

    Hi,

    Measuring the text yourself will be quite difficult. There's a much easier way to get the behavior you want using the built-in tooltip support on the UIElements.

     


            private void Form1_Load(object sender, System.EventArgs e)
            {
                this.ultraCombo1.CreationFilter = new MyCreationFilter();
            }


        public class MyCreationFilter : IUIElementCreationFilter
        {
            #region IUIElementCreationFilter Members

            void IUIElementCreationFilter.AfterCreateChildElements(UIElement parent)
            {
                EditorWithTextDisplayTextUIElement editorWithTextDisplayTextUIElement = parent as EditorWithTextDisplayTextUIElement;
                if (editorWithTextDisplayTextUIElement != null)
                {
                    editorWithTextDisplayTextUIElement.ToolTipEnabled = true;
                }
            }

            bool IUIElementCreationFilter.BeforeCreateChildElements(UIElement parent)
            {
                return false;
            }

            #endregion
        }

Reply Children