Hello,
I have an Ultracombo with some data loaded at runtime.
The text could be quite large, so it could be truncated in visualization. I can show the whole text of a row in the dropdown area using the TipStyleCell property, but is there a way to do the same thing in the text area (so when a particular row is selected and the dropdown grid is closed)? Or is there a way to "know" that the text is truncated and so show a tooltip when you hover the mouse on the Ultracombo?
Thanks
Hello mtgc,
I wanted to know if you were able to solve your issue based on these suggestions or you still need help. Please let me know.
Sorry for the late reply.
Actually I still need help, because I can't use an UltracomboEditor instead of Ultracombo (I need multiple columns).
Still looking for a way to determine if the text is fully visible in the text area or not
Hi,
As I said, there's no simple way to do this. I took another look and I checked to see if the control itself is keeping track of this information, but it is not. So the only thing you can do here is measure the text yourself using DrawUtility.MeasureString and the compare that the RectInsideBorder of the EditorWithTextUIElement.
Try something like this:
private bool IsTextFullyVisible(UltraCombo combo) { Graphics gr = DrawUtility.GetCachedGraphics(this.ultraCombo1); Font fontToDispose = null; try { AppearanceData appData = new AppearanceData(); AppearancePropFlags requestedProps = AppearancePropFlags.FontData; this.ultraCombo1.ResolveAppearance(ref appData, requestedProps); fontToDispose = appData.CreateFont(this.ultraCombo1.Font); Font font = fontToDispose != null ? fontToDispose : this.ultraCombo1.Font; EmbeddableUIElementBase editorElement = this.ultraCombo1.UIElement.GetDescendant(typeof(EmbeddableUIElementBase)) as EmbeddableUIElementBase; Size size = Size.Ceiling(DrawUtility.MeasureString(gr, this.ultraCombo1.Text, font, editorElement.Owner, editorElement.OwnerContext)); return editorElement.RectInsideBorders.Width > size.Width; } finally { if (fontToDispose != null) fontToDispose.Dispose(); DrawUtility.ReleaseCachedGraphics(gr); } }
I think this will only work when the combo does not have focus (is not in edit mode). Also, you might have to play around with the return statement here - there is probably a little bit of padding inside the element, so you might need to add a couple of pixels to the width here to make it accurate all the time.