当前位置: 首页>>代码示例>>C++>>正文


C++ CFont::CreatePointFontIndirect方法代码示例

本文整理汇总了C++中CFont::CreatePointFontIndirect方法的典型用法代码示例。如果您正苦于以下问题:C++ CFont::CreatePointFontIndirect方法的具体用法?C++ CFont::CreatePointFontIndirect怎么用?C++ CFont::CreatePointFontIndirect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CFont的用法示例。


在下文中一共展示了CFont::CreatePointFontIndirect方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Render

void CTitlePane::Render(CDC* pDC,CRect& area)
{
    LOGFONT lf;
    ::memset(&lf,0,sizeof(lf));
    ::strcpy(lf.lfFaceName,"Tahoma");
    lf.lfHeight = 120;
	lf.lfWeight = FW_BOLD;
    CFont f;
    f.CreatePointFontIndirect(&lf);
    CFont*old = pDC->SelectObject(&f);

    m_title.Draw(pDC);
    pDC->SelectObject(old);
    f.DeleteObject();





    ::memset(&lf,0,sizeof(lf));
    ::strcpy(lf.lfFaceName,"Arial");
    lf.lfHeight = 80;
    f.CreatePointFontIndirect(&lf);
    old = pDC->SelectObject(&f);

    m_details.Draw(pDC);
    pDC->SelectObject(old);
    f.DeleteObject();
}
开发者ID:mattcawley,项目名称:mnews,代码行数:29,代码来源:TitlePane.cpp

示例2: OnInitialUpdate

void CGumpListView::OnInitialUpdate()
{
	CListView::OnInitialUpdate();
	if (m_bInit) return;
	m_bInit = true;

	LoadGumpDesc(GUMP_DESC_FILE);

	CListCtrl& ctrl = GetListCtrl();

	ctrl.ModifyStyle(0, LVS_REPORT|LVS_SINGLESEL|LVS_SHOWSELALWAYS);
	ctrl.SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES);

	LOGFONT lf;
	memset(&lf, 0, sizeof(lf));
	HGDIOBJ hFont = ::GetStockObject(OEM_FIXED_FONT);
	::GetObject(hFont, sizeof(lf), &lf);

	lf.lfHeight = 100;
	lf.lfPitchAndFamily = FIXED_PITCH;

	CFont font;

	font.CreatePointFontIndirect(&lf);

	ctrl.SetFont(&font);
	font.Detach();

	ctrl.InsertColumn(0, "Gump ID", LVCFMT_RIGHT,60);
	ctrl.InsertColumn(1, "Size",	LVCFMT_RIGHT,60);
	ctrl.InsertColumn(2, "Desc",	LVCFMT_LEFT,100);

	CString strText;
	cGumpLoader* pGumpLoader = GetDocument()->GetGumpLoader(); ASSERT(pGumpLoader);

	int w=0,h=0,iItem=0;
	for (int i = 0; i < pGumpLoader->GetGumpCount(); i++)
	{
		pGumpLoader->GetGumpSize(i, w, h);
		if (w==0 || h==0) continue;
		
		strText.Format("0x%04X", i);
		iItem = ctrl.InsertItem(i, strText);
		strText.Format("%dx%d", w,h);
		ctrl.SetItemText(iItem, 1, strText);
		ctrl.SetItemData(iItem, i);

		LPCTSTR desc = GetGumpDesc(i);
		if (desc)
			ctrl.SetItemText(iItem, 2, desc);

		//if (i > 100) break;
	}
	
}
开发者ID:BackupTheBerlios,项目名称:iris-svn,代码行数:55,代码来源:GumpListView.cpp

示例3: TextStyleCreateFont

void TextStyleCreateFont (const CBCGPTextStyleRef& textStyle, CBCGPDrawContext& drawCtx, CFont& font)
{
    LOGFONT lf;
    ZeroMemory (&lf, sizeof (lf));

    CString strFontName = textStyle.GetFontName ();
    double dPointSize = textStyle.GetFontSize ();

    lstrcpyn (lf.lfFaceName, strFontName, LF_FACESIZE);
    lf.lfHeight = (long)(dPointSize * 10 * drawCtx.GetScale ());
    lf.lfWeight = textStyle.IsBold () ? FW_BOLD : FW_NORMAL;
    lf.lfItalic = textStyle.IsItalic ();
    font.CreatePointFontIndirect (&lf, drawCtx.GetDC ());
}
开发者ID:cugxiangzhenwei,项目名称:WorkPlatForm,代码行数:14,代码来源:BCGPTextStyle.cpp

示例4: CreateFont

CFont* OSDRegion::CreateFont(int iFont, int iFontSize)
{
	CDC* pDC = GetDC();
	int iFontPoints = iFontSize == 0 ? -120 : iFontSize == 1 ? -140 : -180;
	int iFontWidth = iFontSize == 0 ? 14 : iFontSize == 1 ? 16 : 19;

	CFont* thefont  = new CFont();

	LOGFONT logFont;
	memset(&logFont, 0, sizeof(LOGFONT));
	logFont.lfCharSet = DEFAULT_CHARSET;
	logFont.lfWeight = FW_BOLD;
	logFont.lfHeight = iFontPoints;
	logFont.lfWidth = -iFontPoints/16;
	strcpy(logFont.lfFaceName, "Arial Narrow" );

	thefont->CreatePointFontIndirect(&logFont, pDC);

	ReleaseDC();
	return thefont;
}
开发者ID:BackupTheBerlios,项目名称:tap-svn,代码行数:21,代码来源:OSDRegion.cpp

示例5: InitFont

/*
================
CSyntaxRichEditCtrl::InitFont
================
*/
void CSyntaxRichEditCtrl::InitFont(void)
{
	LOGFONT lf;
	CFont font;
	PARAFORMAT pf;
	int logx, tabSize;

	// set the font
	memset(&lf, 0, sizeof(lf));
	lf.lfHeight = FONT_HEIGHT * 10;
	lf.lfWidth = FONT_WIDTH * 10;
	lf.lfCharSet = ANSI_CHARSET;
	lf.lfPitchAndFamily = FIXED_PITCH | FF_MODERN;
	strcpy(lf.lfFaceName, FONT_NAME);
	font.CreatePointFontIndirect(&lf);

	SetFont(&font);

	// get the tab size in twips
	logx = ::GetDeviceCaps(GetDC()->GetSafeHdc(), LOGPIXELSX);
	tabSize = TAB_SIZE * FONT_WIDTH * 1440 / logx;

	// set the tabs
	memset(&pf, 0, sizeof(PARAFORMAT));
	pf.cbSize = sizeof(PARAFORMAT);
	pf.dwMask = PFM_TABSTOPS;

	for (pf.cTabCount = 0; pf.cTabCount < MAX_TAB_STOPS; pf.cTabCount++) {
		pf.rgxTabs[pf.cTabCount] = pf.cTabCount * tabSize;
	}

	SetParaFormat(pf);

	memset(&defaultCharFormat, 0, sizeof(defaultCharFormat));
	defaultCharFormat.dwMask = CFM_CHARSET | CFM_FACE | CFM_SIZE | CFM_BOLD | CFM_COLOR | CFM_PROTECTED | CFM_BACKCOLOR;
	defaultCharFormat.yHeight = FONT_HEIGHT * 20;
	defaultCharFormat.bCharSet = ANSI_CHARSET;
	defaultCharFormat.bPitchAndFamily = FIXED_PITCH | FF_MODERN;
	defaultCharFormat.crTextColor = SRE_COLOR_BLACK;
	defaultCharFormat.crBackColor = DEFAULT_BACK_COLOR;
	defaultCharFormat.dwEffects = CFE_PROTECTED;
	strcpy(defaultCharFormat.szFaceName, FONT_NAME);
	defaultCharFormat.cbSize = sizeof(defaultCharFormat);

	SetDefaultCharFormat(defaultCharFormat);

	defaultColor = SRE_COLOR_BLACK;
	singleLineCommentColor = SRE_COLOR_DARK_GREEN;
	multiLineCommentColor = SRE_COLOR_DARK_GREEN;
	stringColor[0] = stringColor[1] = SRE_COLOR_DARK_CYAN;
	literalColor = SRE_COLOR_GREY;
	braceHighlightColor = SRE_COLOR_RED;

	// get the default tom::ITextFont
	tom::ITextRange *irange;
	tom::ITextFont *ifont;

	m_TextDoc->Range(0, 0, &irange);
	irange->get_Font(&ifont);

	ifont->get_Duplicate(&m_DefaultFont);

	ifont->Release();
	irange->Release();
}
开发者ID:AreaScout,项目名称:dante-doom3-odroid,代码行数:70,代码来源:CSyntaxRichEditCtrl.cpp

示例6: OnPaint

/////////////////////////////////////////////////////////////////////////////
// CCtlTipOfTheDayText message handlers
void CCtlTipOfTheDayText::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
  // get rectangle of the text area inside dialog
  RECT rectWin;
  GetWindowRect(&rectWin);
  ScreenToClient(&rectWin);

  // calculate positions of the upper and left rectangle and separating line
  int iy, ix0, ix1;
  RECT rectUp;
  RECT rectDn;
  ix0 = rectUp.left = rectDn.left = rectWin.left;
  ix1 = rectUp.right = rectDn.right = rectWin.right;
  iy = rectUp.bottom = rectDn.top = int((rectWin.bottom+rectWin.top)*0.25f);
  rectUp.top = rectWin.top;
  rectDn.bottom = rectWin.bottom;
  InflateRect(&rectDn, -5,-10);
  InflateRect(&rectUp, -5,-10);
  OffsetRect(&rectDn, 0,5);
  OffsetRect(&rectUp, 0,5);

  // draw white rectangle with sunken edge
  CBrush brWhite;
  brWhite.CreateStockObject(WHITE_BRUSH);
  dc.FillRect(&rectWin, &brWhite);
  dc.DrawEdge(&rectWin, BDR_SUNKENOUTER, BF_RIGHT|BF_BOTTOM|BF_TOP);

  // draw separating line
  CBrush brGray;
  brGray.CreateStockObject(GRAY_BRUSH);
  dc.SelectObject(brGray);
  dc.MoveTo(ix0-1, iy);
  dc.LineTo(ix1, iy);

  // create two fonts, big and small
  LOGFONT lf;

  ::ZeroMemory (&lf, sizeof (lf));
  lf.lfHeight = 145;
  lf.lfWeight = FW_BOLD;
  lf.lfItalic = FALSE;
  wcscpy(lf.lfFaceName, L"Times New Roman");
  CFont fontBig;
  fontBig.CreatePointFontIndirect (&lf);

  ::ZeroMemory (&lf, sizeof (lf));
  lf.lfHeight = 100;
  lf.lfWeight = FW_NORMAL;
  lf.lfItalic = FALSE;
  wcscpy(lf.lfFaceName, L"Arial");
  CFont fontSmall;
  fontSmall.CreatePointFontIndirect (&lf);

  // print heading with big font
  dc.SelectObject(&fontBig);
  dc.DrawText("Did you know...", &rectUp, DT_VCENTER|DT_SINGLELINE);

  // print text with small font
  dc.SelectObject(&fontSmall);
  dc.DrawText(m_strTipText, &rectDn, DT_WORDBREAK);
}
开发者ID:EgoIncarnate,项目名称:Serious-Engine,代码行数:65,代码来源:CtlTipOfTheDayText.cpp


注:本文中的CFont::CreatePointFontIndirect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。