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
Hi,
That's much more complicated. What you would have to do in order to achieve that is replace the EditorWithTextDisplayTextUIElement with your own derived element class which overrides the IToolTipItem.ToolTipItem method. That way you could return your own ToolTipInfo and you would have total control over the tooltip. But it's very tricky to implement - you would basically have to handle everything yourself.
That is great!! BTW, is there a way to set the position of the tooltip so that it positions itself right on top of the combo box?
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 }
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 }