?
Solved

Right Aligning Text in a CListView

Posted on 1997-10-15
7
Medium Priority
?
498 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
[X]
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
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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 200 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

Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

Question has a verified solution.

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

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: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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 is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

770 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