本文整理汇总了C++中CFont::GetObject方法的典型用法代码示例。如果您正苦于以下问题:C++ CFont::GetObject方法的具体用法?C++ CFont::GetObject怎么用?C++ CFont::GetObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFont
的用法示例。
在下文中一共展示了CFont::GetObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetFont
BOOL CPMenuSpecial::SetFont (CFont &pFont)
{
TEXTMETRIC tm;
CFont *pOldFont;
CDC TVDC;
LOGFONT LogFont;
m_Font.DeleteObject ();
if (pFont.GetObject (sizeof (LogFont), &LogFont) != 0)
{
if (m_Font.CreateFontIndirect (&LogFont) != 0)
{
if (m_Font.GetObject (sizeof (LogFont), &LogFont) != 0)
{
if (TVDC.CreateDC ("DISPLAY", NULL, NULL, NULL) != 0)
{
if ((pOldFont = TVDC.SelectObject (&m_Font)) != NULL)
{
TVDC.GetTextMetrics (&tm);
m_nDefaultTextHeight = tm.tmHeight;
TVDC.SelectObject (pOldFont);
return TRUE;
}
}
}
m_Font.DeleteObject ();
}
}
return FALSE;
}
示例2: OnChooseFont
void CPadView::OnChooseFont()
{
// get current font description
CFont* pFont = GetFont();
LOGFONT lf;
if (pFont != NULL)
pFont->GetObject(sizeof(LOGFONT), &lf);
else
::GetObject(GetStockObject(SYSTEM_FONT), sizeof(LOGFONT), &lf);
CFontDialog dlg(&lf, CF_SCREENFONTS|CF_INITTOLOGFONTSTRUCT);
if (dlg.DoModal() == IDOK)
{
// switch to new font.
m_font.DeleteObject();
if (m_font.CreateFontIndirect(&lf))
{
CWaitCursor wait;
SetFont(&m_font);
m_lfDefFont = lf;
if (GetPrinterFont() == NULL)
{
// notify container that content has changed
GetDocument()->UpdateAllItems(NULL);
}
}
}
}
示例3: CreateFont
void CHyperlinkStatic::CreateFont()
{
CFont* pFontParent = GetParent()->GetFont();
if ( pFontParent ) {
LOGFONT lf;
pFontParent->GetObject(sizeof(lf), &lf);
lf.lfUnderline = TRUE;
_fontCaption.CreateFontIndirect(&lf);
_bCreateFont = true;
}
}
示例4: PreSubclassWindow
void CMyLabel::PreSubclassWindow() {
CStatic::PreSubclassWindow();
CFont* cf = GetFont();
if(cf !=NULL) {
cf->GetObject(sizeof(m_logFont),&m_logFont);
} else {
GetObject(GetStockObject(SYSTEM_FONT),sizeof(m_logFont), &m_logFont);
}
m_font.DeleteObject();
m_font.CreateFontIndirect(&m_logFont);
}
示例5: PreSubclassWindow
//////////////////////////////////////////////////////////////////////////
//
// Function: CLabel::PreSubclassWindow
//
// Description: Assigns default dialog font
//
// INPUTS:
//
// RETURNS:
//
// NOTES:
//
// MODIFICATIONS:
//
// Name Date Version Comments
// NT ALMOND 15092000 1.5 Origin
// NT ALMOND 02072002 1.6 Fix crash when GetFont returns NULL
//////////////////////////////////////////////////////////////////////////
void CLabel::PreSubclassWindow()
{
CStatic::PreSubclassWindow();
CFont* cf = GetFont();
if(cf !=NULL)
{
cf->GetObject(sizeof(m_lf),&m_lf);
}
else
{
GetObject(GetStockObject(SYSTEM_FONT),sizeof(m_lf),&m_lf);
}
ReconstructFont();
}
示例6: PreSubclassWindow
void CHyperLink::PreSubclassWindow()
{
// Enable notifications - CStatic has this disabled by default
ModifyStyle(0, SS_NOTIFY);
// By default use the label text as the URL
if (m_strURL.IsEmpty())
GetWindowText(m_strURL);
CString strWndText;
GetWindowText(strWndText);
if (strWndText.IsEmpty())
{
SetWindowText(m_strURL);
}
LOGFONT lf;
CFont* pFont = GetFont();
if (pFont)
pFont->GetObject(sizeof(lf), &lf);
else
{
NONCLIENTMETRICS metrics = { 0 };
metrics.cbSize = sizeof(NONCLIENTMETRICS);
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &metrics, FALSE);
memcpy_s(&lf, sizeof(LOGFONT), &metrics.lfMessageFont, sizeof(LOGFONT));
}
m_StdFont.CreateFontIndirect(&lf);
lf.lfUnderline = TRUE;
m_UnderlineFont.CreateFontIndirect(&lf);
SetDefaultCursor(); // try loading a "hand" cursor
SetUnderline();
CRect rect;
GetClientRect(rect);
m_ToolTip.Create(this);
m_ToolTip.AddTool(this, m_strURL, rect, TOOLTIP_ID);
CStatic::PreSubclassWindow();
}
示例7: OnBnClickedSelectHypertextFont
void CPPgDisplay::OnBnClickedSelectHypertextFont()
{
if (GetAsyncKeyState(VK_CONTROL) < 0)
m_eSelectFont = sfLog;
else
m_eSelectFont = sfServer;
// get current font description
CFont* pFont;
if (m_eSelectFont == sfLog)
pFont = &theApp.m_fontLog;
else
pFont = &theApp.m_fontHyperText;
LOGFONT lf;
if (pFont != NULL)
pFont->GetObject(sizeof(LOGFONT), &lf);
else
AfxGetMainWnd()->GetFont()->GetLogFont(&lf);
// Initialize 'CFontDialog'
CFontDialog dlg(&lf, CF_SCREENFONTS | CF_INITTOLOGFONTSTRUCT);
dlg.m_cf.Flags |= CF_APPLY | CF_ENABLEHOOK;
// Set 'lpfnHook' to our own Hook function. But save MFC's hook!
_pfnChooseFontHook = dlg.m_cf.lpfnHook;
dlg.m_cf.lpfnHook = ChooseFontHook;
_pThis = this;
if (dlg.DoModal() == IDOK)
{
if (m_eSelectFont == sfLog)
theApp.emuledlg->ApplyLogFont(&lf);
else
theApp.emuledlg->ApplyHyperTextFont(&lf);
}
_pfnChooseFontHook = NULL;
_pThis = NULL;
}
示例8: PreSubclassWindow
void CTCGroupBox::PreSubclassWindow()
{
// TODO: Add your specialized code here and/or call the base class
CButton::PreSubclassWindow();
//modified the style to avoid text overlap when press tab
ModifyStyle(0, BS_ICON);
// Get Defalut Font
CFont* cf = GetFont();
if(cf !=NULL)
{
cf->GetObject(sizeof(m_lf),&m_lf);
}
else
{
GetObject(GetStockObject(SYSTEM_FONT),sizeof(m_lf),&m_lf);
}
ReconstructFont();
}
示例9: PreSubclassWindow
///////////////////////////////////////////////////////////////////////////////
// PreSubclassWindow
void CXHTMLStatic::PreSubclassWindow()
{
// We want to get mouse clicks via STN_CLICKED
DWORD dwStyle = GetStyle();
::SetWindowLong(GetSafeHwnd(), GWL_STYLE, dwStyle | SS_NOTIFY);
CStatic::PreSubclassWindow();
CFont* cf = GetFont();
LOGFONT lf;
if (cf != NULL)
{
cf->GetObject(sizeof(lf), &lf);
}
else
{
GetObject(GetStockObject(SYSTEM_FONT), sizeof(lf), &lf);
}
m_font.DeleteObject();
VERIFY(m_font.CreateFontIndirect(&lf));
}
示例10: OnBeginPrinting
void CEditView::OnBeginPrinting(CDC* pDC, CPrintInfo*)
{
ASSERT_VALID(this);
ASSERT_VALID(pDC);
// initialize page start vector
ASSERT(m_aPageStart.GetSize() == 0);
m_aPageStart.Add(0);
ASSERT(m_aPageStart.GetSize() > 0);
if (m_hPrinterFont == NULL)
{
// get current screen font object metrics
CFont* pFont = GetFont();
LOGFONT lf;
LOGFONT lfSys;
if (pFont == NULL)
return;
VERIFY(pFont->GetObject(sizeof(LOGFONT), &lf));
VERIFY(::GetObject(::GetStockObject(SYSTEM_FONT), sizeof(LOGFONT),
&lfSys));
if (lstrcmpi((LPCTSTR)lf.lfFaceName, (LPCTSTR)lfSys.lfFaceName) == 0)
return;
// map to printer font metrics
HDC hDCFrom = ::GetDC(NULL);
lf.lfHeight = ::MulDiv(lf.lfHeight, pDC->GetDeviceCaps(LOGPIXELSY),
::GetDeviceCaps(hDCFrom, LOGPIXELSY));
lf.lfWidth = ::MulDiv(lf.lfWidth, pDC->GetDeviceCaps(LOGPIXELSX),
::GetDeviceCaps(hDCFrom, LOGPIXELSX));
::ReleaseDC(NULL, hDCFrom);
// create it, if it fails we just use the printer's default.
m_hMirrorFont = ::CreateFontIndirect(&lf);
m_hPrinterFont = m_hMirrorFont;
}
ASSERT_VALID(this);
}
示例11: OnInitDialog
BOOL CServerWnd::OnInitDialog()
{
if (theApp.m_fontLog.m_hObject == NULL)
{
CFont* pFont = GetDlgItem(IDC_MYINFO)->GetFont();
LOGFONT lf;
pFont->GetObject(sizeof lf, &lf);
theApp.m_fontLog.CreateFontIndirect(&lf);
}
ReplaceRichEditCtrl(GetDlgItem(IDC_MYINFOLIST), this, GetDlgItem(IDC_MYINFO)->GetFont());
CResizableDialog::OnInitDialog();
// using ES_NOHIDESEL is actually not needed, but it helps to get around a tricky window update problem!
// If that style is not specified there are troubles with right clicking into the control for the very first time!?
#define LOG_PANE_RICHEDIT_STYLES WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL | ES_MULTILINE | ES_READONLY | ES_NOHIDESEL
CRect rect;
GetDlgItem(IDC_SERVMSG)->GetWindowRect(rect);
GetDlgItem(IDC_SERVMSG)->DestroyWindow();
::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rect, 2);
if (servermsgbox->Create(LOG_PANE_RICHEDIT_STYLES, rect, this, IDC_SERVMSG)){
servermsgbox->SetProfileSkinKey(_T("ServerInfoLog"));
servermsgbox->ModifyStyleEx(0, WS_EX_STATICEDGE, SWP_FRAMECHANGED);
servermsgbox->SendMessage(EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(3, 3));
servermsgbox->SetEventMask(servermsgbox->GetEventMask() | ENM_LINK);
servermsgbox->SetFont(&theApp.m_fontHyperText);
servermsgbox->ApplySkin();
servermsgbox->SetTitle(GetResString(IDS_SV_SERVERINFO));
/* ismod: mod version
servermsgbox->AppendText(_T("eMule v") + theApp.m_strCurVersionLong + _T("\n"));
*/
servermsgbox->AppendText(_T("eMule v") + theApp.m_strCurVersionLong + _T(" ") + theApp.m_strCurVersionLongMod + _T("\n"));
// MOD Note: Do not remove this part - Merkur
/* ismod: no new version check
m_strClickNewVersion = GetResString(IDS_EMULEW) + _T(" ") + GetResString(IDS_EMULEW3) + _T(" ") + GetResString(IDS_EMULEW2);
servermsgbox->AppendHyperLink(_T(""), _T(""), m_strClickNewVersion, _T(""));
*/
// MOD Note: end
servermsgbox->AppendText(_T("\n\n"));
// ismod: ed2k club link
m_strED2kClub = _T("Посетить Клуб \"Ословеды\"");
servermsgbox->AppendHyperLink(_T(""), _T(""), m_strED2kClub, _T(""));
servermsgbox->AppendText(_T("\n\n"));
}
GetDlgItem(IDC_LOGBOX)->GetWindowRect(rect);
GetDlgItem(IDC_LOGBOX)->DestroyWindow();
::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rect, 2);
if (logbox->Create(LOG_PANE_RICHEDIT_STYLES, rect, this, IDC_LOGBOX)){
logbox->SetProfileSkinKey(_T("Log"));
logbox->ModifyStyleEx(0, WS_EX_STATICEDGE, SWP_FRAMECHANGED);
logbox->SendMessage(EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(3, 3));
if (theApp.m_fontLog.m_hObject)
logbox->SetFont(&theApp.m_fontLog);
logbox->ApplySkin();
logbox->SetTitle(GetResString(IDS_SV_LOG));
logbox->SetAutoURLDetect(FALSE);
}
GetDlgItem(IDC_DEBUG_LOG)->GetWindowRect(rect);
GetDlgItem(IDC_DEBUG_LOG)->DestroyWindow();
::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rect, 2);
if (debuglog->Create(LOG_PANE_RICHEDIT_STYLES, rect, this, IDC_DEBUG_LOG)){
debuglog->SetProfileSkinKey(_T("VerboseLog"));
debuglog->ModifyStyleEx(0, WS_EX_STATICEDGE, SWP_FRAMECHANGED);
debuglog->SendMessage(EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(3, 3));
if (theApp.m_fontLog.m_hObject)
debuglog->SetFont(&theApp.m_fontLog);
debuglog->ApplySkin();
debuglog->SetTitle(SZ_DEBUG_LOG_TITLE);
debuglog->SetAutoURLDetect(FALSE);
}
SetAllIcons();
Localize();
serverlistctrl.Init();
TCITEM newitem;
CString name;
name = GetResString(IDS_SV_SERVERINFO);
name.Replace(_T("&"), _T("&&"));
newitem.mask = TCIF_TEXT | TCIF_IMAGE;
newitem.pszText = const_cast<LPTSTR>((LPCTSTR)name);
newitem.iImage = 1;
VERIFY( StatusSelector.InsertItem(StatusSelector.GetItemCount(), &newitem) == PaneServerInfo );
name = GetResString(IDS_SV_LOG);
name.Replace(_T("&"), _T("&&"));
newitem.mask = TCIF_TEXT | TCIF_IMAGE;
newitem.pszText = const_cast<LPTSTR>((LPCTSTR)name);
newitem.iImage = 0;
VERIFY( StatusSelector.InsertItem(StatusSelector.GetItemCount(), &newitem) == PaneLog );
name = SZ_DEBUG_LOG_TITLE;
name.Replace(_T("&"), _T("&&"));
newitem.mask = TCIF_TEXT | TCIF_IMAGE;
newitem.pszText = const_cast<LPTSTR>((LPCTSTR)name);
//.........这里部分代码省略.........
示例12: rectText
//***************************************************************************
//
//
//***************************************************************************
BOOL DrawVerticalText
(
CDC* pDC,
const CRect& rectWindow,
CString szcText,
const DWORD dwStyle
)
{
int nSavedDC = pDC->SaveDC();
//
// Start by getting this control's font, and then tweak it a bit.
//
LOGFONT lf;
CFont *pTmpFont = pDC->GetCurrentFont();
if( NULL == pTmpFont )
{
ASSERT( pTmpFont ); // Font not selected in DC!
return FALSE;
}
pTmpFont->GetObject( sizeof(LOGFONT), &lf );
//
// Text will be rotated counter-clockwise 90 degrees.
//
lf.lfOrientation = lf.lfEscapement = 900;
//
// We need a TrueType font to get rotated text. MS Sans Serif
// won't cut it! Opps! A hard coded string!
//
lstrcpy( lf.lfFaceName, _T("Tahoma") );
//
// Create a font with the tweaked attributes.
//
CFont font;
if( FALSE == font.CreateFontIndirect( &lf ) )
{
TRACE2("Error creating font! Line: %d, File: %s\n", __LINE__, __FILE__ );
return FALSE;
}
CFont *pfontOld = pDC->SelectObject( &font );
CRect rectText( rectWindow );
//
// Compute size of horizontal oriented string
//
pDC->DrawText ( CString(szcText),
rectText,
DT_LEFT
|DT_TOP
|DT_CALCRECT
|DT_SINGLELINE );
//
// Dependence on format flags, compute offset of text rectangle
// Horizontal offset is constant for all formats
// Vertical offset depend on format
//
CSize szOffset(0,0);
if ( dwStyle & SS_CENTER )
{
szOffset = CSize( (rectWindow.Width()-rectText.Height())/2,
-(rectWindow.Height()-rectText.Width())/2+rectText.Height() );
}
else if ( dwStyle & SS_RIGHT )
{
szOffset = CSize( (rectWindow.Width()-rectText.Height())/2,
-rectWindow.Height()+rectText.Width()+rectText.Height() );
}
else
{
szOffset = CSize( (rectWindow.Width()-rectText.Height())/2,
rectText.Height() );
}
//
// Convert dimensions of horizontal oriented rectangle
// to dimensions of vertical oriented rectangle
// (swap horizontal and vertical sizes)
// rectText.SetRect( rectWindow.left, 0, rectWindow.left + rectText.Height(), rectWindow.Height());
// rectText.SetRect( rectWindow.left, rectWindow.top, rectText.right, rectWindow.Height());
//
rectText.top = rectWindow.top;
rectText.bottom = rectWindow.bottom;
//
// Offset text rectangle
//.........这里部分代码省略.........
示例13: OnPaint
///////////////////////////////////////////////////////////////////////////////
// OnPaint
void CXHTMLStatic::OnPaint()
{
CPaintDC dc(this); // device context for painting
// get text from control
CString strText = _T("");
GetWindowText(strText);
// replace character entity names with codes
TCHAR ent[3] = { 0 };
ent[0] = _T('\001'); // each entity name is replaced with a two-character
// code that begins with \001
for (int i = 0; m_aCharEntities[i].pszName != NULL; i++)
{
ent[1] = m_aCharEntities[i].cCode;
strText.Replace(m_aCharEntities[i].pszName, ent);
}
CString str1 = _T("");
int index = 0;
// set text and background colors
COLORREF crText = m_crText;
COLORREF prev_crText = crText;
COLORREF crBackground = m_crBackGround;
COLORREF prev_crBackground = crBackground;
CFont *pOldFont = dc.SelectObject(&m_font);
int n = strText.GetLength();
CRect rect;
GetClientRect(&rect);
//dc.FillSolidRect(&rect, m_crBackGround);
// allow for margins
rect.left += m_nLeftMargin;
rect.right -= m_nRightMargin;
int nInitialXOffset = 0;//m_nLeftMargin;
m_yStart = rect.top;
LOGFONT lf, prev_lf;
if (m_bLogFont)
{
memcpy(&lf, &m_lf, sizeof(lf));
}
else
{
CFont* cf = GetFont();
if (cf)
cf->GetObject(sizeof(lf), &lf);
else
GetObject(GetStockObject(SYSTEM_FONT), sizeof(lf), &lf);
}
memcpy(&prev_lf, &lf, sizeof(lf));
CString strAnchorText = _T("");
BOOL bSizeChange = FALSE;
//BOOL bEndOfSizeChange = FALSE;
TEXTMETRIC tm;
dc.GetTextMetrics(&tm);
while (n > 0)
{
///////////////////////////////////////////////////////////////////////
if (_tcsnicmp(strText, _T("<B>"), 3) == 0) // check for <b> or <B>
{
n -= 3;
index = strText.Find(_T('>'));
if (index != -1)
strText = strText.Mid(index+1);
m_bBold++;// = TRUE;
continue;
}
///////////////////////////////////////////////////////////////////////
else if (_tcsnicmp(strText, _T("</B>"), 4) == 0) // check for </B>
{
n -= 4;
index = strText.Find(_T('>'));
if (index != -1)
strText = strText.Mid(index+1);
if (m_bBold)
m_bBold--;// = FALSE;
continue;
}
///////////////////////////////////////////////////////////////////////
else if (_tcsnicmp(strText, _T("<I>"), 3) == 0) // check for <I>
{
n -= 3;
index = strText.Find(_T('>'));
if (index != -1)
strText = strText.Mid(index+1);
m_bItalic++;// = TRUE;
//.........这里部分代码省略.........
示例14: OnInitDialog
BOOL CServerWnd::OnInitDialog()
{
if (theApp.m_fontLog.m_hObject == NULL)
{
CFont* pFont = GetDlgItem(IDC_SSTATIC)->GetFont();
LOGFONT lf;
pFont->GetObject(sizeof lf, &lf);
theApp.m_fontLog.CreateFontIndirect(&lf);
}
ReplaceRichEditCtrl(GetDlgItem(IDC_MYINFOLIST), this, GetDlgItem(IDC_SSTATIC)->GetFont());
CResizableDialog::OnInitDialog();
// using ES_NOHIDESEL is actually not needed, but it helps to get around a tricky window update problem!
// If that style is not specified there are troubles with right clicking into the control for the very first time!?
#define LOG_PANE_RICHEDIT_STYLES WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL | ES_MULTILINE | ES_READONLY | ES_NOHIDESEL
CRect rect;
GetDlgItem(IDC_SERVMSG)->GetWindowRect(rect);
GetDlgItem(IDC_SERVMSG)->DestroyWindow();
::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rect, 2);
if (servermsgbox->Create(LOG_PANE_RICHEDIT_STYLES, rect, this, IDC_SERVMSG)){
servermsgbox->SetProfileSkinKey(_T("ServerInfoLog"));
servermsgbox->ModifyStyleEx(0, WS_EX_STATICEDGE, SWP_FRAMECHANGED);
servermsgbox->SendMessage(EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(3, 3));
servermsgbox->SetEventMask(servermsgbox->GetEventMask() | ENM_LINK);
servermsgbox->SetFont(&theApp.m_fontHyperText);
servermsgbox->ApplySkin();
servermsgbox->SetTitle(GetResString(IDS_SV_SERVERINFO));
//Xman ModID
/*
servermsgbox->AppendText(_T("eMule v") + theApp.m_strCurVersionLong + _T("\n"));
*/
// ==> ModID [itsonlyme/SiRoB] - Stulle
/*
servermsgbox->AppendText(_T("eMule v") + theApp.m_strCurVersionLong + _T(" [") + MOD_VERSION + _T("]") + _T("\n"));
*/
servermsgbox->AppendText(_T("eMule v") + theApp.m_strCurVersionLong + _T(" [") + theApp.m_strModLongVersion + _T("]\n"));
// <== ModID [itsonlyme/SiRoB] - Stulle
//Xman end
// MOD Note: Do not remove this part - Merkur
m_strClickNewVersion = GetResString(IDS_EMULEW) + _T(" ") + GetResString(IDS_EMULEW3) + _T(" ") + GetResString(IDS_EMULEW2);
servermsgbox->AppendHyperLink(_T(""), _T(""), m_strClickNewVersion, _T(""));
// MOD Note: end
//Xman versions check
// ==> Removed Xtreme version check [Stulle] - Stulle
/*
servermsgbox->AppendText(_T("\n"));
m_strClickNewXtremeVersion=_T("Click to check for new Xtreme-Version");
servermsgbox->AppendHyperLink(_T(""),_T(""),m_strClickNewXtremeVersion,_T(""));
*/
// <== Removed Xtreme version check [Stulle] - Stulle
//Xman end
servermsgbox->AppendText(_T("\n\n"));
}
GetDlgItem(IDC_LOGBOX)->GetWindowRect(rect);
GetDlgItem(IDC_LOGBOX)->DestroyWindow();
::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rect, 2);
if (logbox->Create(LOG_PANE_RICHEDIT_STYLES, rect, this, IDC_LOGBOX)){
logbox->SetProfileSkinKey(_T("Log"));
logbox->ModifyStyleEx(0, WS_EX_STATICEDGE, SWP_FRAMECHANGED);
logbox->SendMessage(EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(3, 3));
if (theApp.m_fontLog.m_hObject)
logbox->SetFont(&theApp.m_fontLog);
logbox->ApplySkin();
logbox->SetTitle(GetResString(IDS_SV_LOG));
logbox->SetAutoURLDetect(FALSE);
}
GetDlgItem(IDC_DEBUG_LOG)->GetWindowRect(rect);
GetDlgItem(IDC_DEBUG_LOG)->DestroyWindow();
::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rect, 2);
if (debuglog->Create(LOG_PANE_RICHEDIT_STYLES, rect, this, IDC_DEBUG_LOG)){
debuglog->SetProfileSkinKey(_T("VerboseLog"));
debuglog->ModifyStyleEx(0, WS_EX_STATICEDGE, SWP_FRAMECHANGED);
debuglog->SendMessage(EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(3, 3));
if (theApp.m_fontLog.m_hObject)
debuglog->SetFont(&theApp.m_fontLog);
debuglog->ApplySkin();
debuglog->SetTitle(SZ_DEBUG_LOG_TITLE);
debuglog->SetAutoURLDetect(FALSE);
}
//Xman Anti-Leecher-Log
GetDlgItem(IDC_LEECHERLOG)->GetWindowRect(rect);
GetDlgItem(IDC_LEECHERLOG)->DestroyWindow();
::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rect, 2);
if (leecherlog->Create(LOG_PANE_RICHEDIT_STYLES, rect, this, IDC_LEECHERLOG)){
leecherlog->SetProfileSkinKey(_T("VerboseLog"));
leecherlog->ModifyStyleEx(0, WS_EX_STATICEDGE, SWP_FRAMECHANGED);
leecherlog->SendMessage(EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(3, 3));
if (theApp.m_fontLog.m_hObject)
leecherlog->SetFont(&theApp.m_fontLog);
leecherlog->ApplySkin();
leecherlog->SetTitle(GetResString(IDS_LEERCHERLOGTITLE));
leecherlog->SetAutoURLDetect(FALSE);
}
//.........这里部分代码省略.........
示例15: OnChoosePrintFont
void CPadView::OnChoosePrintFont()
{
CWaitCursor wait;
CFont* pFont = GetPrinterFont();
LOGFONT lf;
LPLOGFONT plf = NULL;
if (pFont != NULL)
{
pFont->GetObject(sizeof(LOGFONT), &lf);
plf = &lf;
}
// magic to get printer dialog that would be used if we were printing!
CPrintDialog dlgPrint(FALSE);
if (!AfxGetApp()->GetPrinterDeviceDefaults(&dlgPrint.m_pd))
{
AfxMessageBox(IDP_ERR_GET_DEVICE_DEFAULTS);
return;
}
wait.Restore();
HDC hdcPrint = dlgPrint.CreatePrinterDC();
if (hdcPrint == NULL)
{
AfxMessageBox(IDP_ERR_GET_PRINTER_DC);
return;
}
CDC dcScreen;
dcScreen.Attach(::GetDC(NULL));
CDC dcPrint;
dcPrint.Attach(hdcPrint);
if (plf != NULL)
{
// need to map initial logfont to screen metrics.
::ScaleLogFont(plf, dcPrint, dcScreen);
}
// now bring up the dialog since we know the printer DC
CFontDialog dlg(plf, CF_PRINTERFONTS, &dcPrint);
if (dlg.DoModal() == IDOK)
{
// map the resulting logfont back to printer metrics.
lf = dlg.m_lf;
::ScaleLogFont(&lf, dcScreen, dcPrint);
SetPrinterFont(NULL);
m_fontPrint.DeleteObject();
if (m_fontPrint.CreateFontIndirect(&lf))
{
SetPrinterFont(&m_fontPrint);
m_lfDefPrintFont = lf;
// notify container that content has changed
GetDocument()->UpdateAllItems(NULL);
}
}
//NOTE: destructor will call dcPrint.DeleteDC
::ReleaseDC(NULL, dcScreen.Detach());
}