Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 511
  • 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.
0
MooreJ
Asked:
MooreJ
1 Solution
 
RONSLOWCommented:
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
 
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.

0
 
MooreJAuthor Commented:
Edited text of question
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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