Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to place CListCtrl text Center Aligned?

1,289 views
Skip to first unread message

Landon

unread,
Jul 23, 2008, 1:07:01 AM7/23/08
to
I use MFC Visual C++ 4.2.

I use a CListCtrl to display data.

I have 2 columns which display "OK" text.

I need to place them Center aligned.

How to do that?

Thank you.

Victor

unread,
Jul 23, 2008, 4:06:03 AM7/23/08
to
Use LVCFMT_CENTER flag while inserting columns.
It doesn't, however, work for the first (inserted with index 0) column which
is always left-aligned.
Possible workarounds:
owner draw
or
inserting a dummy (hidden) column as the first one.

Victor

Mikel

unread,
Jul 23, 2008, 5:45:25 AM7/23/08
to
For the first column, you can also insert it twice, then
DeleteColumn(0).
I do it and it works fine

> > Thank you.- Ocultar texto de la cita -
>
> - Mostrar texto de la cita -

Victor

unread,
Jul 23, 2008, 6:00:07 AM7/23/08
to
Great!
I never considered such a possibility! (although, I almost never needed to
set a "non-standard" allignment for the first column)

Victor

0 new messages