-
List View Problem
Hi there!
In a List View I want to allign one of the columns to the right. So I wrote the code:
Code:
hListView=::CreateWindowEx(NULL,WC_LISTVIEW,"#1006",
WS_VISIBLE | WS_CHILD | LVS_REPORT | LVS_EDITLABELS,
0,0,500,250,this->m_hWnd,NULL,theApp.m_hInstance,NULL);
lvColumn.pszText="Sum";
lvColumn.mask=LVCF_FMT | LVCF_TEXT | LVCF_WIDTH | LVCF_ORDER;
lvColumn.fmt=LVCFMT_RIGHT;
lvColumn.iOrder=0;
lvColumn.cx=50;
::SendMessage(hListView,LVM_INSERTCOLUMN,0,(LPARAM) &lvColumn);
lvColumn.pszText="Person";
lvColumn.mask=LVCF_FMT | LVCF_TEXT | LVCF_WIDTH | LVCF_ORDER;
lvColumn.iOrder=1;
lvColumn.cx=130;
lvColumn.fmt=LVCFMT_CENTER;
::SendMessage(hListView,LVM_INSERTCOLUMN,0,(LPARAM) &lvColumn);
But all of the columns are left-alligned. Where am I wrong?
Any suggestions are appreciated.
-
Check out MSDN.
http://msdn.microsoft.com/library/de...s/lvcolumn.asp
You need to createa temporary first column. For some reason, the first column in a list view is always left-aligned.
Kuphryn