Solved

Right Align Column in CListCtrl

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

lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;

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 ?
0
Comment
Question by:wise_man
  • 3
  • 2
5 Comments
 
LVL 7

Expert Comment

by:galkin
Comment Utility
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.


0
 

Author Comment

by:wise_man
Comment Utility
No, I don't want to change column order, I want to Left or Right Justify text inside the column.
0
 
LVL 7

Accepted Solution

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

Author Comment

by:wise_man
Comment Utility
Yes, owner draw will solve the problem, but is it really necessary ? why can't Microsoft make our live easier ?
0
 

Author Comment

by:wise_man
Comment Utility
Yes, owner draw will solve the problem, but is it really necessary ? why can't Microsoft make our live easier ?
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

772 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now