I'm having an issue with the grid where if I have a string of text with newline characters and leading spaces on the following line, then if the column is at a certain width, the ellipsis is not being displayed. The text trimming is set to EllipsisWordWithLineLimit. Please see the screenshot:
The full text in the cell is below. Each line starts with 3 spaces. Isolation Type: CONTACT; Indication for Isolation: Rotavirus Isolation Type: CONTACT; Indication for Isolation: RSV Isolation Type: CONTACT; Indication for Isolation: Scabies Isolation Type: CONTACT; Indication for Isolation: Shingles Isolation Type: CONTACT; Indication for Isolation: VRE Isolation Type: AIRBORNE+CONTACT; Indication for Isolation: Disseminated Herpes Zoster Isolation Type: AIRBORNE+CONTACT; Indication for Isolation: SARS Isolation Type: AIRBORNE+CONTACT; Indication for Isolation: Smallpox Isolation Type: DROPLET; Indication for Isolation: Flu/H1N1 Isolation Type: DROPLET; Indication for Isolation: Diptheria Isolation Type: DROPLET; Indication for Isolation: Meningocococcemia Isolation Type: DROPLET; Indication for Isolation: Mumps Isolation Type: DROPLET; Indication for Isolation: Meningitis, Bacterial Isolation Type: DROPLET; Indication for Isolation: Pertussis Isolation Type: DROPLET; Indication for Isolation: Rubella Isolation Type: DROPLET+CONTACT; Indication for Isolation: Rule Out Flu/RSW Isolation Type: CONTACT; Indication for Isolation: Rotavirus Isolation Type: CONTACT; Indication for Isolation: RSV Isolation Type: CONTACT; Indication for Isolation: Scabies Isolation Type: CONTACT; Indication for Isolation: Shingles Isolation Type: CONTACT; Indication for Isolation: VRE Isolation Type: AIRBORNE+CONTACT; Indication for Isolation: Disseminated Herpes Zoster Isolation Type: AIRBORNE+CONTACT; Indication for Isolation: SARS Isolation Type: AIRBORNE+CONTACT; Indication for Isolation: Smallpox Isolation Type: DROPLET; Indication for Isolation: Flu/H1N1 Isolation Type: DROPLET; Indication for Isolation: Diptheria Isolation Type: DROPLET; Indication for Isolation: Meningocococcemia Isolation Type: DROPLET; Indication for Isolation: Mumps Isolation Type: DROPLET; Indication for Isolation: Meningitis, Bacterial Isolation Type: DROPLET; Indication for Isolation: Pertussis Isolation Type: DROPLET; Indication for Isolation: Rubella Isolation Type: DROPLET+CONTACT; Indication for Isolation: Rule Out Flu/RSW
Hello,
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.
The TextTrimming setting is ultimately translated into flags that are used for the DrawString method in GDI or GDI Plus. So it's really Windows that does the drawing of the text. My guess is that there is some quirky behavior with that particular setting that doesn't apply when using multiline. But like I said above, it's really hard to say without knowing all the various other settings at work here.
You might want to try switching to GDI (grid.TextRenderingMode) and see if the behavior is any better with that setting.
To answer your question about doing this yourself, you could use a DrawFilter or a CreationFilter to try to draw the text on your own. But I wouldn't recommend it. It a lot more complicated than you may think.
I did try EllipsisCharacterWithLineLimit for the TextTrimming mode and the bug does not appear. Any idea why that mode would work but EllipsisWordWithLineLimit does not?
I've gone through the enum of TextTrimming values and EllipsisWordWithLineLimit is what I need. None of the other values would be suitable.
Is there a way to manually do the text trimming? If there was a way to determine how much text is actually displayed so I can add the ellipsis myself?