(HOWTO) HOWTO: Determine Justification in a ListView Control

ID: Q198589


The information in this article applies to:
  • Microsoft Visual C++, 32-bit Editions, versions 4.0, 4.1, 4.2, 5.0, 6.0


SUMMARY

The documentation for the LVCOLUMN structure used by the ListView common control indicates that you can use the fmt member of the LVCOLUMN structure to set the justification of a column in the ListView control. This article shows you how to determine the value of the justification of a column in the ListView control.


MORE INFORMATION

Before you check the value of the fmt member of the LVCOLUMN structure, the value of this member must be bitwise "anded" with the flag LVCFMT_JUSTIFYMASK, which is defined in Commctrl.h. For example, the following code shows you how to determine whether the second column in a list view is right, center, or left justified:


   LVCOLUMN lvc;
   // Assume hWndOfLV is an HWND of an existing ListView control window.
   if(ListView_GetColumn(hWndOfLV, GetColumn, 1, &lvc))
   {
      switch(lvc.fmt & LVCFMT_JUSTIFYMASK)
      {
         case LVCFMT_RIGHT:
            // Right justified
            break;
         case LVCFMT_CENTER:
            // Center justified
            break;
         case LFCFMT_LEFT:
            // Left justified
            break;
      }
   } 

© Microsoft Corporation 1999, All Rights Reserved.
Contributions by Isaac Leon Varon, Microsoft Corporation

Additional query words: justify CListView CListCtrl

Keywords : kbCtrl kbVC400 kbVC410 kbVC420 kbVC500 kbVC600
Version : winnt:4.0,4.1,4.2,5.0,6.0
Platform : winnt
Issue type : kbhowto


Last Reviewed: July 23, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.