本文整理汇总了C++中CFontDialog类的典型用法代码示例。如果您正苦于以下问题:C++ CFontDialog类的具体用法?C++ CFontDialog怎么用?C++ CFontDialog使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CFontDialog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ASSERT
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));
}
}
示例2: ASSERT
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;
}
示例3: OnFonts
void CVisualSynanView::OnFonts()
{
CFontDialog dlgFonts;
if( dlgFonts.DoModal() != IDOK)
return;
LOGFONT lfOldFont;
LogFontCpy(&lfOldFont, m_LogFontForWords);
dlgFonts.GetCurrentFont(&m_LogFontForWords);
CString str = dlgFonts.GetFaceName();
CClientDC dc(this);
EnumFontFamiliesEx(dc.m_hDC, &m_LogFontForWords, &TestIfTrueTypeEx,(LPARAM)this,0);
if( !m_bExistUsefulFont )
{
::AfxMessageBox(IDS_NOT_TRUE_TYPE);
LogFontCpy(&m_LogFontForWords,lfOldFont);
return;
}
if(!(m_LogFontForWords.lfCharSet & RUSSIAN_CHARSET) )
{
::AfxMessageBox(IDS_NOT_RUSSIAN_CHARSET);
LogFontCpy(&m_LogFontForWords,lfOldFont);
return;
};
// m_LogFontForWords has changed!!
UpdateFontsFromLogFont();
CClientDC clDC(this);
Recalculate(clDC);
Invalidate();
}
示例4: OnEditFont
LRESULT CMainFrame::OnEditFont(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
HRESULT hr = E_FAIL;
if (m_view.GetSelection().size() > 0)
{
CTextObject* pTextObject = dynamic_cast<CTextObject*>(m_view.GetSelection().front());
if (pTextObject)
{
//LOGFONT defaultFont = {0};
//StringCchCopy(defaultFont.lfFaceName, _countof(defaultFont.lfFaceName), TEXT("Times New Roman"));
//defaultFont.lfHeight = 18;
//HFONT hDefaultFont = (HFONT)::GetStockObject(DEFAULT_GUI_FONT);
CFontDialog dlg;
dlg.DoModal();
LONG nFontHeight = -MulDiv(dlg.m_cf.lpLogFont->lfHeight, 72, 96);
pTextObject->GetRichEditPanel()->SetTextFontName(0, 0, dlg.m_cf.lpLogFont->lfFaceName);
pTextObject->GetRichEditPanel()->SetTextFontSize(0, 0, nFontHeight);
pTextObject->GetRichEditPanel()->SetTextForeColor(0, 0, dlg.m_cf.rgbColors);
//COM_VERIFY(pTextObject->GetRichEditPanel()->SetTextFont(0, 0, dlg.m_cf.lpLogFont , 0xFFFFFFFF));
//COM_VERIFY(pTextObject->GetRichEditPanel()->SetTextForeColor(0, 0, dlg.m_cf.rgbColors));
}
}
return 0;
}
示例5: dlg
void CStyleDlgFonts::OnButtonFont()
{
CFontDialog dlg (m_stcFont.GetLogfont (), CF_EFFECTS | CF_BOTH, NULL, this);
dlg.m_cf.rgbColors = m_stcFont.GetColor ();
if (dlg.DoModal () == IDOK)
{
m_stcFont.SetPreviewFont (&dlg.m_cf);
memcpy (&m_pStyle->m_lfTitle[m_RenderType], dlg.m_cf.lpLogFont, sizeof (LOGFONT));
if (dlg.m_cf.rgbColors)
m_pStyle->m_crTitle[m_RenderType] = dlg.m_cf.rgbColors;
CMDIChildWnd* pChild = ((CMDIFrameWnd*) AfxGetMainWnd ())->MDIGetActive ();
if (pChild != NULL)
{
CCdCoverCreator2Doc* pDoc = (CCdCoverCreator2Doc*) pChild->GetActiveDocument ();
if (pDoc != NULL)
{
// pDoc->m_pTracks->SetRTFTitle ("", m_RenderType);
pDoc->ApplyStyleToRTFTitles (m_pStyle, m_RenderType);
pDoc->UpdateAllViews (NULL);
pDoc->CheckPoint ();
}
}
}
}
示例6: switch
UINT CALLBACK CPPgDisplay::ChooseFontHook(HWND hdlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
{
UINT uResult;
// Call MFC's common dialog Hook function
if (_pfnChooseFontHook != NULL)
uResult = (*_pfnChooseFontHook)(hdlg, uiMsg, wParam, lParam);
else
uResult = 0;
// Do our own Hook processing
switch (uiMsg)
{
case WM_COMMAND:
if (LOWORD(wParam) == psh3/*Apply*/ && HIWORD(wParam) == BN_CLICKED)
{
LOGFONT lf;
CFontDialog *pDlg = (CFontDialog *)CWnd::FromHandle(hdlg);
ASSERT( pDlg != NULL );
if (pDlg != NULL)
{
pDlg->GetCurrentFont(&lf);
if (_pThis->m_eSelectFont == sfLog)
theApp.emuledlg->ApplyLogFont(&lf);
else
theApp.emuledlg->ApplyHyperTextFont(&lf);
}
}
break;
}
// If the hook procedure returns zero, the default dialog box procedure processes the message.
return uResult;
}
示例7: OnButtonfont
void CPropertyDialog::OnButtonfont()
{
// TODO: Add your control notification handler code here
CFontDialog dlg;
dlg.m_cf.rgbColors=(m_shape->GetClr());
dlg.m_cf.lpLogFont->lfHeight = m_shape->GetlogFont()->lfHeight;
dlg.m_cf.lpLogFont->lfWidth = m_shape->GetlogFont()->lfWidth;
dlg.m_cf.lpLogFont->lfEscapement = m_shape->GetlogFont()->lfEscapement;
dlg.m_cf.lpLogFont->lfOrientation = m_shape->GetlogFont()->lfOrientation;
dlg.m_cf.lpLogFont->lfWeight = m_shape->GetlogFont()->lfWeight;
dlg.m_cf.lpLogFont->lfItalic = m_shape->GetlogFont()->lfItalic;
dlg.m_cf.lpLogFont->lfUnderline = m_shape->GetlogFont()->lfUnderline;
dlg.m_cf.lpLogFont->lfStrikeOut = m_shape->GetlogFont()->lfStrikeOut;
dlg.m_cf.lpLogFont->lfCharSet = m_shape->GetlogFont()->lfCharSet;
dlg.m_cf.lpLogFont->lfOutPrecision = m_shape->GetlogFont()->lfOutPrecision;
dlg.m_cf.lpLogFont->lfClipPrecision = m_shape->GetlogFont()->lfClipPrecision;
dlg.m_cf.lpLogFont->lfQuality = m_shape->GetlogFont()->lfQuality;
dlg.m_cf.lpLogFont->lfPitchAndFamily=m_shape->GetlogFont()->lfPitchAndFamily;
strcpy (dlg.m_cf.lpLogFont->lfFaceName, m_shape->GetlogFont()->lfFaceName);
if(IDOK==dlg.DoModal())
{
if((m_shape->GetFont())->m_hObject)
(m_shape->GetFont())->DeleteObject();
(m_shape->GetFont())->CreateFontIndirect(dlg.m_cf.lpLogFont);
m_shape->SetClr(dlg.m_cf.rgbColors);
m_shape->SetlogFont(dlg.m_cf.lpLogFont);
Invalidate();
}
}
示例8: OnFont
void CGraphicView::OnFont()
{
CFontDialog dlg;
if(IDOK==dlg.DoModal())
{
if(m_font.m_hObject)
m_font.DeleteObject();
m_font.CreateFontIndirect(dlg.m_cf.lpLogFont);
m_strFontName=dlg.m_cf.lpLogFont->lfFaceName;
Invalidate();
}
}
示例9: OnButtonSelectFont
void DlgSetPrintStyle::OnButtonSelectFont()
{
// TODO: Add your control notification handler code here
CFontDialog cfd;
cfd.m_cf.Flags |= ( CF_NOSTYLESEL | CF_NOSIZESEL);
if (cfd.DoModal() == IDOK)
{
m_strFont = cfd.GetFaceName();
m_wndFontName.SetWindowText(m_strFont);
}
}
示例10: OnFormatFont
void CTextView::OnFormatFont()
{
CFontDialog fd;
if (IDOK == fd.DoModal())
{
if (NULL != font.m_hObject)
{
font.DeleteObject();
}
font.CreateFontIndirect(&fd.m_lf);
SetFont(&font, TRUE);
}
}
示例11: OnBnClickedFontsetbtn
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);
}
}
示例12: OnFont
void CLabelDlg::OnFont()
{
CFontDialog dlg;
if (dlg.DoModal() == IDOK)
{
LOGFONT logFont;
dlg.GetCurrentFont (&logFont);
m_pLabel->SetFont (&logFont);
m_pLabel->SetTextColor(dlg.GetColor ());
OnChanged();
}
}
示例13: OnEditorSelectfont
void COptionPageTextFormat::OnEditorSelectfont()
{
// select font for editor
CFontDialog fontdlg;
LOGFONT tmpFont = m_logfont;
fontdlg.m_cf.lpLogFont = &tmpFont;
fontdlg.m_cf.Flags |= CF_INITTOLOGFONTSTRUCT;
fontdlg.m_cf.Flags &= ~CF_EFFECTS;
if (fontdlg.DoModal() == IDOK)
fontdlg.GetCurrentFont(&m_logfont);
UpdateFontExample();
}
示例14: dlg
void CSTWTitleFontsPage::OnButtonTitlefontInlaysidefont()
{
CFontDialog dlg (m_InlaySideFont.GetLogfont (), CF_EFFECTS | CF_BOTH, NULL, this);
dlg.m_cf.rgbColors = m_InlaySideFont.GetColor ();
if (dlg.DoModal () == IDOK)
{
m_InlaySideFont.SetPreviewFont (&dlg.m_cf);
CStyleTemplate* pTmp = ((CStyleTemplateWizard*) GetParent ())->m_pTemplate;
memcpy (&pTmp->m_lfInlaySide, dlg.m_cf.lpLogFont, sizeof (LOGFONT));
if (dlg.m_cf.rgbColors)
pTmp->m_crInlaySide = dlg.m_cf.rgbColors;
((CStyleTemplateWizard*) GetParent ())->m_wndPreview.InvalidateRect (NULL);
}
}
示例15: dlg
void CSTWTrackFontsPage::OnButtonTrackGroupingRemarksfont()
{
CFontDialog dlg (m_TrackGroupingRemarksFont.GetLogfont (), CF_EFFECTS | CF_BOTH, NULL, this);
dlg.m_cf.rgbColors = m_TrackGroupingRemarksFont.GetColor ();
if (dlg.DoModal () == IDOK)
{
m_TrackGroupingRemarksFont.SetPreviewFont (&dlg.m_cf);
CStyleTemplate* pTmp = ((CStyleTemplateWizard*) GetParent ())->m_pTemplate;
memcpy (&pTmp->m_lfTrackGroupingRemarks, dlg.m_cf.lpLogFont, sizeof (LOGFONT));
if (dlg.m_cf.rgbColors)
pTmp->m_crTrackGroupingRemarks = dlg.m_cf.rgbColors;
((CStyleTemplateWizard*) GetParent ())->m_wndPreview.InvalidateRect (NULL);
}
}