Right Align Column in CListCtrl

Posted on 1997-12-08
Last Modified: 2013-11-20
I'm trying to make my CListCtrl (LVS_REPORT) column right align by using:
LV_COLUMN            lvColumn;


The problem is this method fail to set the first column to right align. All column except first column can be set.
Did any of you know what's going wrong ?
Question by:wise_man
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2

Expert Comment

ID: 1311844
If you want to change the order of columns in list view control you can use message LVM_SETCOLUMNORDERARRAY. Parameters are
LPARAM is Address of an array that specifies the order in which columns should be displayed, in left-to-right order. For example, if the contents of the array are {2,0,1}, the control displays column 2, column 0, and column 1 in that order.
WPARAM is size, in elements, of the buffer at array. You can also use macro ListView_SetColumnOrderArray instead. But remember, that this message is supported only for comctl32.dll version 4.70 or higher installed by InetSDK or Internet Explorer 3.0 or higher.


Author Comment

ID: 1311845
No, I don't want to change column order, I want to Left or Right Justify text inside the column.

Accepted Solution

galkin earned 50 total points
ID: 1311846
In this case you must create owner draw list control and perform custom drawing right justifying text in columns

Author Comment

ID: 1311847
Yes, owner draw will solve the problem, but is it really necessary ? why can't Microsoft make our live easier ?

Author Comment

ID: 1311848
Yes, owner draw will solve the problem, but is it really necessary ? why can't Microsoft make our live easier ?

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Need a Shell script to start a service checking the port 6 56
not able to insert into temp table 68 178
abstract class with all non abstract mentods 6 87
Sed question 2 139
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question