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. Change LVS_ALIGNLEFT by LVS_ALIGNTOP

Change LVS_ALIGNLEFT by LVS_ALIGNTOP

Scheduled Pinned Locked Moved C / C++ / MFC
question
9 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.
  • _ Offline
    _ Offline
    _Flaviu
    wrote on last edited by
    #1

    How can I change LVS_ALIGNLEFT by LVS_ALIGNTOP (of an CListCtrl) at runtime ? The list has LVS_ICON style already ... Thank you.

    L F 2 Replies Last reply
    0
    • _ _Flaviu

      How can I change LVS_ALIGNLEFT by LVS_ALIGNTOP (of an CListCtrl) at runtime ? The list has LVS_ICON style already ... Thank you.

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

      See http://msdn.microsoft.com/en-us/library/windows/desktop/bb774735(v=vs.85).aspx#ListView_Styles_and_Views[^].

      1 Reply Last reply
      0
      • _ _Flaviu

        How can I change LVS_ALIGNLEFT by LVS_ALIGNTOP (of an CListCtrl) at runtime ? The list has LVS_ICON style already ... Thank you.

        F Offline
        F Offline
        Freak30
        wrote on last edited by
        #3

        What you are looking for is the funtion CWnd::ModifyStyle.

        The good thing about pessimism is, that you are always either right or pleasently surprised.

        _ 1 Reply Last reply
        0
        • F Freak30

          What you are looking for is the funtion CWnd::ModifyStyle.

          The good thing about pessimism is, that you are always either right or pleasently surprised.

          _ Offline
          _ Offline
          _Flaviu
          wrote on last edited by
          #4

          I tried both solutions:

          ListView_SetExtendedListViewStyleEx(m_List.GetSafeHwnd(), LVS_ALIGNMASK, LVS_ALIGNLEFT);

          and

          m_List.ModifyStyle(LVS_ALIGNTOP, LVS_ALIGNLEFT);

          none of them are working ... I am not figure out why ...

          L 1 Reply Last reply
          0
          • _ _Flaviu

            I tried both solutions:

            ListView_SetExtendedListViewStyleEx(m_List.GetSafeHwnd(), LVS_ALIGNMASK, LVS_ALIGNLEFT);

            and

            m_List.ModifyStyle(LVS_ALIGNTOP, LVS_ALIGNLEFT);

            none of them are working ... I am not figure out why ...

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

            You need to use

            DWORD dwStyle = GetWindowLong(m_hWnd, GWL_STYLE);
            // modify the style mask as required
            SetWindowLong(m_hWnd, GWL_STYLE, dwStyle);

            There are probably some MFC shortcuts to this.

            _ 1 Reply Last reply
            0
            • L Lost User

              You need to use

              DWORD dwStyle = GetWindowLong(m_hWnd, GWL_STYLE);
              // modify the style mask as required
              SetWindowLong(m_hWnd, GWL_STYLE, dwStyle);

              There are probably some MFC shortcuts to this.

              _ Offline
              _ Offline
              _Flaviu
              wrote on last edited by
              #6

              "There are probably some MFC shortcuts to this" Yes, there is ModifyStyle (ModifyStyleEx), but seems not working either ...

              L _ 2 Replies Last reply
              0
              • _ _Flaviu

                "There are probably some MFC shortcuts to this" Yes, there is ModifyStyle (ModifyStyleEx), but seems not working either ...

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

                Flaviu2 wrote:

                but seems not working

                Maybe you are not doing it correctly.

                1 Reply Last reply
                0
                • _ _Flaviu

                  "There are probably some MFC shortcuts to this" Yes, there is ModifyStyle (ModifyStyleEx), but seems not working either ...

                  _ Offline
                  _ Offline
                  _Flaviu
                  wrote on last edited by
                  #8

                  Is working by

                  ModifyStyle(LVS_ALIGNMASK, LVS_ALIGNTOP);

                  _ 1 Reply Last reply
                  0
                  • _ _Flaviu

                    Is working by

                    ModifyStyle(LVS_ALIGNMASK, LVS_ALIGNTOP);

                    _ Offline
                    _ Offline
                    _Flaviu
                    wrote on last edited by
                    #9

                    I noticed something: in order to work correctly, before I change the aligment style, I have to setup scrollbars of list control to top/bottom ... orelse, the list looks uggly (all items are bad drawned) ... it is logical to happend that ? I am thinking that if I setup vertical scrollbar on some position, if I change the aligment style to horizontal, it doesn't fit at he same horizontal position ...

                    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