BOOL COXFontPickerButton::OnClicked() { ASSERT(::IsWindow(m_hWnd)); // Use font common dialog CFontDialog* pFontDlg; CFont* pFont=GetBuddyFont(); LOGFONT lf; if(pFont==NULL) { pFontDlg=new CFontDialog(); } else { pFont->GetLogFont(&lf); pFontDlg=new CFontDialog(&lf); } pFontDlg->m_cf.rgbColors=GetBuddyTextColor(); if(pFontDlg->DoModal()==IDOK && m_pBuddy!=NULL) { pFontDlg->GetCurrentFont(&lf); SetBuddyLogFont(&lf,FALSE); COLORREF clr=pFontDlg->GetColor(); SetBuddyTextColor(clr,TRUE); } delete pFontDlg; return FALSE; }
void CListOptionCtrl::SetItemFont() { if(!UpdateData(TRUE)) return; int nIndex = m_listBoxEx.GetCurSel(); COLORREF colorItemText; CFont fontItem; CFont* pFont= m_arrFonts[nIndex]; ASSERT(pFont!=NULL); LOGFONT lf; CFontDialog dlgFont; dlgFont.m_cf.lpLogFont = &lf; if(dlgFont.DoModal() == IDOK) { //VERIFY(fontItem.GetLogFont(&lf)); colorItemText = dlgFont.GetColor(); if(pFont->m_hObject!=NULL) VERIFY(pFont->DeleteObject()); VERIFY(pFont->CreateFontIndirect(&lf)); VERIFY(m_listBoxEx.SetItemFont(nIndex, pFont)); VERIFY(m_listBoxEx.SetItemTextColor(nIndex, colorItemText)); } }
void CTextPadDlg::OnBnClickedFontsetbtn() { // TODO: Add your control notification handler code here CFontDialog dlg; //CFontDialog로 현재 폰트 변경 if(dlg.DoModal() == IDOK){ color = dlg.GetColor(); dlg.GetCurrentFont(&log); font.DeleteObject(); font.CreateFontIndirect(&log); GetDlgItem(IDC_EDIT1)->SetFont(&font); } }
void CLabelDlg::OnFont() { CFontDialog dlg; if (dlg.DoModal() == IDOK) { LOGFONT logFont; dlg.GetCurrentFont (&logFont); m_pLabel->SetFont (&logFont); m_pLabel->SetTextColor(dlg.GetColor ()); OnChanged(); } }
//***************************************************************************************** void CFontItem::OnClickButton (CPoint /*point*/) { CBCGPGridCtrl* pGridCtrl = GetOwnerList(); ASSERT_VALID (pGridCtrl); ASSERT_VALID (this); ASSERT_VALID (m_pWndInPlace); ASSERT (::IsWindow (m_pWndInPlace->GetSafeHwnd ())); m_bButtonIsDown = TRUE; Redraw (); CFontDialog dlg (&m_lf); if (m_Color != (COLORREF)-1) { dlg.m_cf.rgbColors = m_Color; } if (dlg.DoModal () == IDOK) { dlg.GetCurrentFont (&m_lf); m_Color = dlg.GetColor (); if (m_pWndInPlace != NULL) { m_pWndInPlace->SetWindowText (FormatProperty ()); } else { m_varValue = (LPCTSTR) FormatProperty (); } } if (m_pWndInPlace != NULL) { m_pWndInPlace->SetFocus (); } else { pGridCtrl->SetFocus (); } m_bButtonIsDown = FALSE; Redraw (); }