Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Right align list column in list view.

Right align list column in list view.

Scheduled Pinned Locked Moved C / C++ / MFC
question
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    I want the first column of my list view to be right aligned but it wont let me align it. I can align any of the other colums to the center or right but the first column is always left align. Is there a way to get the first column right aligned?

    M 1 Reply Last reply
    0
    • L Lost User

      I want the first column of my list view to be right aligned but it wont let me align it. I can align any of the other colums to the center or right but the first column is always left align. Is there a way to get the first column right aligned?

      M Offline
      M Offline
      Michael P Butler
      wrote on last edited by
      #2

      From MSDN If a column is added to a list-view control with index 0 (the leftmost column) and with LVCFMT_RIGHT or LVCFMT_CENTER specified, the text is not right-aligned or centered. The text in the index 0 column is left-aligned. Therefore if you keep inserting columns with index 0, the text in all columns are left-aligned. If you want the first column to be right-aligned or centered you can make a dummy column, then insert one or more columns with index 1 or higher and specify the alignment you require. Finally delete the dummy column. Michael :-) Time flies like an arrow. Fruit flies like a banana

      D L 2 Replies Last reply
      0
      • M Michael P Butler

        From MSDN If a column is added to a list-view control with index 0 (the leftmost column) and with LVCFMT_RIGHT or LVCFMT_CENTER specified, the text is not right-aligned or centered. The text in the index 0 column is left-aligned. Therefore if you keep inserting columns with index 0, the text in all columns are left-aligned. If you want the first column to be right-aligned or centered you can make a dummy column, then insert one or more columns with index 1 or higher and specify the alignment you require. Finally delete the dummy column. Michael :-) Time flies like an arrow. Fruit flies like a banana

        D Offline
        D Offline
        dlhson
        wrote on last edited by
        #3

        Wow, it's cool !!!!! Hung Son A Vietnamese student i-g.hypermart.net dlhson2001@yahoo.com

        1 Reply Last reply
        0
        • M Michael P Butler

          From MSDN If a column is added to a list-view control with index 0 (the leftmost column) and with LVCFMT_RIGHT or LVCFMT_CENTER specified, the text is not right-aligned or centered. The text in the index 0 column is left-aligned. Therefore if you keep inserting columns with index 0, the text in all columns are left-aligned. If you want the first column to be right-aligned or centered you can make a dummy column, then insert one or more columns with index 1 or higher and specify the alignment you require. Finally delete the dummy column. Michael :-) Time flies like an arrow. Fruit flies like a banana

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Thanks, that should do the trick. :)

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups