You are formating the text properly, you just need to change the font. There are two ways to change the font in a list box.
1) Change the font for your whole application to "Courier New" by using the dialog properties option in your resource editor.
2) Use the OnDrawItem method. See the below link for help.
Just above and below the DrawText routine add the folloing code.
CFont *pOldFont = NULL;
if (Font.CreatePointFont(120, _T("Courier New"), &dc))
pOldFont = dc.SelectObject(&Font);
if (pOldFont != NULL)
: i have a listbox in which text is to be displayed coloumn wise as shown below
: 1 ABCD 23 21 12
: 2 wwww 23 22 22
: Right now i am storing each item of a row in a CString. And for displaying each row i use the following code
: sDisplayStr.Format("%-10s%-10s%-10s%-10s%-10s%", sSlNo, sName, sText1, sText2, sText3);
: where sSlNo = "1", sName = "ABCD", sText1 = "23", sText2 = "21", sText3 = "12"
: I am not able to format the text properly. could anybody help me out please?
: Also i want to know how do i change the font of the list box contents to courier new?