2 Replies - 2910 Views - Last Post: 04 May 2012 - 09:38 AM Rate Topic: -----

#1 Criel  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 128
  • Joined: 11-March 11

Adding a new line in a listview item

Posted 04 May 2012 - 07:09 AM

Hello,

I currently have a line of text in my listview that is too long for the current width of my listview, without increasing the width of my listview, is there a way to add a newline within the listview line item so that it's 2 or 3 lines long so there's no need to have the user scroll to see the text?
Is This A Good Question/Topic? 0
  • +

Replies To: Adding a new line in a listview item

#2 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5529
  • View blog
  • Posts: 11,839
  • Joined: 02-June 10

Re: Adding a new line in a listview item

Posted 04 May 2012 - 09:17 AM

What you are describing is commonly called "word wrap" and ListView doesn't do it.

You'd have to inherit from ListView to make your own control then use OwnerDrawn to handle all the drawing yourself.

You're not the first person to want this, so there are various controls already out there that you can use. Like this one.

http://www.codeproje...-List-View-v1-3
Was This Post Helpful? 1
  • +
  • -

#3 CharlieMay  Icon User is offline

  • This space intentionally left blank
  • member icon

Reputation: 1605
  • View blog
  • Posts: 5,162
  • Joined: 25-September 09

Re: Adding a new line in a listview item

Posted 04 May 2012 - 09:38 AM

You could also use a datagridview and set the wrapmode and AutoRowSize properties.

With a little bit of some setting changes and some code it would be easy to make it look and somewhat act like a listview.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1