nitindixit
April 2nd, 1999, 01:09 PM
How to right align the text within CListBox
|
Click to See Complete Forum and Search --> : CListBox nitindixit April 2nd, 1999, 01:09 PM How to right align the text within CListBox Lynx April 2nd, 1999, 07:00 PM 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 Alek April 3rd, 1999, 05:19 PM 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. codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |