1

For example I have a big sentence:

"I like to eat pie and have fun around the house all day long!" And I want it to appear like this:

"I like to eat pie and have fun around the house all day long!"

In this post: Multi-line list items on WinForms ListView control? Grammarian said that you only need to have WordWrap on but I cannot find that option.

Thanks for the help in advanced

1
  • Thanks for the very good library, I have seen that turning on Wordwrap only wraps string for the first column. Can it be done for the other column as well?
    – user1980017
    Jan 15, 2013 at 10:54

1 Answer 1

5

Each column has a WordWrap property. Set that to true and the text of that column will wrap.

Remember, the list must be OwnerDrawn for the wrapping to be visible.

EDIT: I looked again today, and you are quite right -- that property has gone! I have no idea where it has vanished to. I'm sure it used to be there :(

OLVColumn should have a property like this:

    [Category("Behavior - ObjectListView"),
     Description("Draw this column cell's word wrapped"),
     DefaultValue(false)]
    public bool WordWrap {
        get { return wordWrap; }
        set { 
            wordWrap = value;
            if (wordWrap) {
                this.Renderer = new BaseRenderer();
                ((BaseRenderer)this.Renderer).CanWrap = true;
                ((BaseRenderer)this.Renderer).UseGdiTextRendering = false;
            } else {
                this.Renderer = null;
            }
        }
    }
    private bool wordWrap;

Put that in, and you'll be able to word wrap your column's contents.

3
  • That property is in the Edit Column options? It's just that I can't find the property. In the list of properties I have, the last one is width. I've also searched in the properties of the object list view with no luck.
    – Tiago
    Apr 18, 2010 at 10:26
  • Thank you so much. I will try that as soon as possible. Sorry for being unable to vote up your answer. I don't have enough reputation yet :(
    – Tiago
    Apr 20, 2010 at 14:57
  • 1
    As of ObjectListView 2.9.0 (and possibly earlier), this per-column WordWrap property is again present and functional.
    – Jay Baxter
    Jan 7, 2016 at 22:36

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.