[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now


Right Aligning Text in a CListView

Posted on 1997-10-15
Medium Priority
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.
Question by:MooreJ
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
LVL 10

Expert Comment

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


Author Comment

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.


Author Comment

ID: 1308196
Edited text of question
Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.


Expert Comment

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

and apply it with the following:

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

Author Comment

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

Accepted Solution

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

Author Comment

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

Featured Post

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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…
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.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

649 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