|
-
April 2nd, 1999, 02:09 PM
#1
CListBox
How to right align the text within CListBox
-
April 2nd, 1999, 08:00 PM
#2
Re: CListBox
If you use "Report" style for your ListBox, you can right align each column text except the first column. When you create the column headers for the ListCtrl, just use the following flag for the column alignment:
LV_COLUMN lvc;
lvc.mask = LVCF_FMT | LVCF_WIDTH |
LVCF_TEXT | LVCF_SUBITEM;
lvc.cx = 60; // width of first column
lvc.fmt = LVCFMT_RIGHT; // align right
for(int i=0; i < 4; i++){
lvc.iSubItem = i;
lvc.pszText = ColumnLabel[i];// Label
m_list.InsertColumn(i,&lvc); // insert it
}
Hope this will help. Good luck.
Lynx
-
April 3rd, 1999, 06:19 PM
#3
Re: CListBox
Add WS_EX_RIGHT extended style to the ListBox.
CListBox MyListBox;
SetWindowLong(MyListBox.m_hWnd, GWL_EXSTYLE, WS_EX_RIGHT)
Also from resources you can go to properties/Extedned Styles and set Right aligned text.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|