Click here to Skip to main content
15,921,989 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionMemory leaks Pin
Eikthrynir2-Dec-06 1:45
Eikthrynir2-Dec-06 1:45 
AnswerRe: Memory leaks Pin
Mark Salsbery2-Dec-06 5:58
Mark Salsbery2-Dec-06 5:58 
GeneralRe: Memory leaks Pin
Eikthrynir2-Dec-06 7:58
Eikthrynir2-Dec-06 7:58 
AnswerRe: Memory leaks Pin
Joe Woodbury2-Dec-06 10:32
professionalJoe Woodbury2-Dec-06 10:32 
GeneralRe: Memory leaks Pin
Eikthrynir2-Dec-06 11:08
Eikthrynir2-Dec-06 11:08 
QuestionApplication Error. The Memory Could not be read Pin
B.Govindarajan2-Dec-06 1:41
B.Govindarajan2-Dec-06 1:41 
AnswerRe: Application Error. The Memory Could not be read Pin
Mark Salsbery2-Dec-06 6:08
Mark Salsbery2-Dec-06 6:08 
QuestionCFont does not work with CListCtrl [modified] Pin
cy163@hotmail.com1-Dec-06 21:42
cy163@hotmail.com1-Dec-06 21:42 
I have a CListCtrl (m_ListCtrlStyled) on a form (A CFormView based application, developed in VC 6.0 SP6).
I initiate the CListCtrl in the OnInitialUpdate() function like the following.
<br />
<br />
	DWORD dwStyle = ::GetWindowLong(m_ListCtrlStyled.m_hWnd, GWL_STYLE); <br />
	dwStyle &= ~(LVS_TYPEMASK);<br />
	dwStyle &= ~(LVS_EDITLABELS);<br />
	//Style setting<br />
	SetWindowLong(m_ListCtrlStyled.m_hWnd, GWL_STYLE, dwStyle| LVS_REPORT|LVS_NOLABELWRAP|LVS_SHOWSELALWAYS);<br />
	<br />
	//Style setting<br />
	DWORD styles = 	LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES|LVS_EX_CHECKBOXES;<br />
	ListView_SetExtendedListViewStyleEx(m_ListCtrlStyled.m_hWnd, styles, 		styles );<br />
	<br />
	m_ListCtrlStyled.SetExtendedStyle(  LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES);<br />
	<br />
	<br />
	//Insert Column Title<br />
	TCHAR rgtsz[3][10] = {_T("SerialNumber"), _T("Doc"), _T("Score")};<br />
	<br />
	LV_COLUMN lvcolumn;<br />
	CRect rect;<br />
	m_ListCtrlStyled.GetWindowRect(&rect);<br />
	for(int i=0;i<3;i++)<br />
	{<br />
		lvcolumn.mask = LVCF_FMT | LVCF_SUBITEM | LVCF_TEXT | LVCF_WIDTH | LVCF_ORDER;<br />
		lvcolumn.fmt = LVCFMT_LEFT;//LVCFMT_CENTER<br />
		lvcolumn.pszText = rgtsz[i];<br />
		lvcolumn.iSubItem = i;<br />
		lvcolumn.iOrder = i;<br />
		switch (i)<br />
		{<br />
		case 0 :<br />
			lvcolumn.cx = rect.Width()*1/10 ; //rect.Width()*3/5<br />
			break;<br />
		case 1:<br />
			lvcolumn.cx = rect.Width()*7/10 ; //rect.Width()*3/5<br />
			break;<br />
		case 2:<br />
			lvcolumn.cx = rect.Width()*2/10 ; //rect.Width()*3/5<br />
			break;<br />
		}<br />
		<br />
		m_ListCtrlStyled.InsertColumn(i, &lvcolumn);<br />
	}<br />
	<br />
	//CFont Varible<br />
	CFont m_font;<br />
		<br />
	m_font.CreateFont(16, 0,0,0,FW_REGULAR, 0,0,0,  DEFAULT_CHARSET, OUT_CHARACTER_PRECIS, CLIP_CHARACTER_PRECIS,  DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Courier"); <br />
	<br />
<br />
<br />
	m_ListCtrlStyled.SetFont(&m_font);<br />
	<br />
	//COLOR<br />
	m_ListCtrlStyled.SetBkColor(RGB(247,247,255)); <br />
	m_ListCtrlStyled.SetTextBkColor(RGB(247,247,255));<br />
<br />
<br />


The problem is that there was no change of the font when I change "arial" of m_font to other font name, say "courier".


i also tried with the following code , but failed again.
<br />
CWnd *pWnd=GetDlgItem(IDC_LIST2);<br />
    CDC *pDC=pWnd->GetDC();<br />
CFont font;<br />
     LOGFONT stFont;<br />
   memset(&stFont,0,sizeof(LOGFONT));<br />
     stFont.lfHeight=MulDiv(12,pDC->GetDeviceCaps(LOGPIXELSY),72); <br />
     stFont.lfWeight=FW_NORMAL;<br />
      stFont.lfCharSet=GB2312_CHARSET;<br />
        strcpy(stFont.lfFaceName,"Arial");//Font setting<br />
      font.CreateFontIndirect(&stFont);<br />
<br />
	pWnd->SetFont(&font,TRUE);<br />
<br />


Please help me my friends



-- modified at 3:51 Saturday 2nd December, 2006
AnswerRe: CFont does not work with CListCtrl Pin
Makakuin1-Dec-06 21:48
Makakuin1-Dec-06 21:48 
GeneralRe: CFont does not work with CListCtrl Pin
cy163@hotmail.com1-Dec-06 21:54
cy163@hotmail.com1-Dec-06 21:54 
GeneralRe: CFont does not work with CListCtrl Pin
Makakuin1-Dec-06 22:00
Makakuin1-Dec-06 22:00 
AnswerRe: CFont does not work with CListCtrl Pin
Mark Salsbery2-Dec-06 6:03
Mark Salsbery2-Dec-06 6:03 
AnswerRe: CFont does not work with CListCtrl Pin
Joe Woodbury2-Dec-06 10:50
professionalJoe Woodbury2-Dec-06 10:50 
AnswerRe: CFont does not work with CListCtrl Pin
cy163@hotmail.com4-Dec-06 10:30
cy163@hotmail.com4-Dec-06 10:30 
QuestionSetting background color to the dialog box Pin
Taruni1-Dec-06 19:35
Taruni1-Dec-06 19:35 
AnswerRe: Setting background color to the dialog box Pin
Rajesh R Subramanian1-Dec-06 19:45
professionalRajesh R Subramanian1-Dec-06 19:45 
AnswerRe: Setting background color to the dialog box Pin
Joe Woodbury2-Dec-06 10:52
professionalJoe Woodbury2-Dec-06 10:52 
QuestionCombo box help Pin
celllllllll1-Dec-06 11:58
celllllllll1-Dec-06 11:58 
AnswerRe: Combo box help Pin
Mark Salsbery1-Dec-06 12:05
Mark Salsbery1-Dec-06 12:05 
GeneralRe: Combo box help Pin
celllllllll1-Dec-06 12:22
celllllllll1-Dec-06 12:22 
GeneralRe: Combo box help Pin
Mark Salsbery1-Dec-06 12:42
Mark Salsbery1-Dec-06 12:42 
GeneralRe: Combo box help Pin
Mark Salsbery1-Dec-06 12:43
Mark Salsbery1-Dec-06 12:43 
GeneralRe: Combo box help Pin
celllllllll1-Dec-06 12:57
celllllllll1-Dec-06 12:57 
GeneralRe: Combo box help Pin
celllllllll1-Dec-06 13:21
celllllllll1-Dec-06 13:21 
GeneralRe: Combo box help Pin
Mark Salsbery1-Dec-06 13:28
Mark Salsbery1-Dec-06 13:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.