• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 517
  • Last Modified:

Right Aligning Text in a CListView

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.
1 Solution
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???

MooreJAuthor Commented:
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.

MooreJAuthor Commented:
Edited text of question
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

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);
MooreJAuthor Commented:
I Know that.  But when I do it from a CListView IT ONLY ALIGNS THE HEADERS!!! Refer to my Question.
Use ownerdraw listview. In DrawItem() function use CDC::DrawText to show text with flag DT_RIGHT. See sample in mfc\general\rowlist
MooreJAuthor Commented:
Perfect example.... I was able to cut/paste to my app...
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now