Solved

Right Aligning Text in a CListView

Posted on 1997-10-15
7
476 Views
Last Modified: 2013-11-20
I can Right Align Text in a CListCtrl but when I try to do it in the CListView only the headers get Right Aligned.  All the data is still left Aligned.
0
Comment
Question by:MooreJ
7 Comments
 
LVL 10

Expert Comment

by:RONSLOW
ID: 1308194
Eh? what do you mean "in a CCtrlView" - CCtrlView is a base class (and not usable as such) for views which are a single control (like CListView).

Did you mean it worked ok for CListCtrl and not CListView???

0
 

Author Comment

by:MooreJ
ID: 1308195
OK... I can't type.  I was having a bad day.  Yes I meant to say:
I can right align in a CListCtrl.  But when I try it in a CListView it only aligns the Headers.

0
 

Author Comment

by:MooreJ
ID: 1308196
Edited text of question
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 3

Expert Comment

by:shaig
ID: 1308197
You should get the list control reference from the view,
with:
CListCtrl& GetListCtrl( ) const; of the CListView object.

and apply it with the following:

InsertColumn(...,..,  LVCFMT_RIGHT);
0
 

Author Comment

by:MooreJ
ID: 1308198
I Know that.  But when I do it from a CListView IT ONLY ALIGNS THE HEADERS!!! Refer to my Question.
0
 
LVL 8

Accepted Solution

by:
gelbert earned 50 total points
ID: 1308199
Use ownerdraw listview. In DrawItem() function use CDC::DrawText to show text with flag DT_RIGHT. See sample in mfc\general\rowlist
0
 

Author Comment

by:MooreJ
ID: 1308200
Perfect example.... I was able to cut/paste to my app...
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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 tutorial demonstrates a quick way of adding group price to multiple Magento products.

757 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

23 Experts available now in Live!

Get 1:1 Help Now