您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CreateFontIndirect函数代码示例

51自学网 2021-06-01 20:14:36
  C++
这篇教程C++ CreateFontIndirect函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中CreateFontIndirect函数的典型用法代码示例。如果您正苦于以下问题:C++ CreateFontIndirect函数的具体用法?C++ CreateFontIndirect怎么用?C++ CreateFontIndirect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

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

示例1: WinInitPicture

void WinInitPicture (int size, int mode,					 int pr, int pg, int pb,					 int br, int bg, int bb,					 char *fname, int fstyle, int fsize,					 HRGN clipRgn,					 BOOL bDoubleBuffered,					 OSPictContext context				    ){	LOGBRUSH lb;	LOGFONT lf;	DWORD style;	context->penSize = size;	context->penPat = iBlackPattern;	context->penMode = mode;	context->penColor = RGB (pr, pg, pb);	context->backColor = RGB (br, bg, bb);	context->lastActivity = FILLING;	if (bDoubleBuffered)	{		RECT clipRect;		if (GetClipBox(context->hDC,&clipRect) == ERROR)		{			printf("osInitPicture -> GetClipBox failed/n");			exit(1);		}		context->hBufferedDC = context->hDC;		context->hDC = CreateCompatibleDC(context->hBufferedDC);		context->hBufferBitmap = CreateCompatibleBitmap(context->hBufferedDC,clipRect.right-clipRect.left,clipRect.bottom-clipRect.top);		SelectObject(context->hDC, context->hBufferBitmap);		if (!BitBlt(context->hDC, 0, 0, clipRect.right-clipRect.left, clipRect.bottom-clipRect.top, context->hBufferedDC, clipRect.left, clipRect.top, SRCCOPY))		{			printf("osDonePicture -> BitBlt failed/n");			exit(1);		}		SetViewportOrgEx(context->hDC,-clipRect.left,-clipRect.top,NULL);	}	thePolygon = NULL;	SetPolyFillMode (context->hDC, WINDING);	strcpy (context->curFont, fname);	context->fontstyle = fstyle;	context->fontsize = PointsToPix(context->hDC,fsize);				// PointsToPix by MW	SetLogFontData (&lf, context->curFont, context->fontstyle, context->fontsize);	if (context->penSize == 1)		style = PS_COSMETIC | PS_SOLID;	else		style = PS_GEOMETRIC | PS_INSIDEFRAME;	lb.lbStyle = BS_SOLID;	lb.lbColor = context->penColor;	lb.lbHatch = 0;	context->theNormalPen = ExtCreatePen (style, context->penSize, &lb, 0, NULL);	lb.lbStyle = BS_SOLID;	lb.lbColor = context->backColor;	lb.lbHatch = 0;	context->theBackPen = ExtCreatePen (style, context->penSize, &lb, 0, NULL);	SetBrushOrgEx (context->hDC,0,0,NULL);	context->theNormalBrush = CreateSolidBrush (context->penColor);	context->theBackBrush = CreateSolidBrush (context->backColor);	context->theFont = CreateFontIndirect (&lf);	SaveDC (context->hDC);	SetWindowOrgEx (context->hDC, 0,0, NULL);	SelectObject (context->hDC, GetStockObject (NULL_PEN));	SelectObject (context->hDC, context->theNormalBrush);	SelectObject (context->hDC, context->theFont);	SetBkMode (context->hDC, TRANSPARENT);	SetBkColor (context->hDC, context->backColor);	SetTextAlign (context->hDC, TA_LEFT | TA_BASELINE);	WinSetMode (context->penMode, context);	SetStretchBltMode (context->hDC,COLORONCOLOR);		/* PA: when stretching bitmaps, use COLORONCOLOR mode. */	if (ghCaretWnd)	{		int mess, p1, p2, p3, p4, p5, p6;		WinKickOsThread (CcRqHIDECARET, (int) ghCaretWnd, 0, 0, 0, 0, 0,						 &mess, &p1, &p2, &p3, &p4, &p5, &p6);	}	if (clipRgn != NULL)		SelectClipRgn (context->hDC, clipRgn);}	/* WinInitPicture */
开发者ID:Ericson2314,项目名称:lighthouse,代码行数:99,


示例2: internal_render_do_paint

static BOOLinternal_render_do_paint (SKINDATA* skind, HDC outhdc){    BUTTON *b;    RECT *prt;    int i;    HDC thdc = skind->bmdc.hdc;    // Create out temp dc if we haven't made it yet    if (m_tempdc.hdc == NULL) {	LOGFONT ft;	m_tempdc.hdc = CreateCompatibleDC (thdc);	m_tempdc.bm = CreateCompatibleBitmap (thdc, WIDTH (skind->background_rect), 					      HEIGHT (skind->background_rect));	SelectObject (m_tempdc.hdc, m_tempdc.bm);	// And the font	memset (&ft, 0, sizeof(LOGFONT));	//strcpy(ft.lfFaceName, "Microsoft Sans pSerif");	strcpy (ft.lfFaceName, "Verdana");	ft.lfHeight = 12;	m_tempfont = CreateFontIndirect(&ft);	SelectObject (m_tempdc.hdc, m_tempfont);    }    // Do the background    BitBlt (m_tempdc.hdc, 	    0, 	    0, 	    WIDTH (skind->background_rect),	    HEIGHT (skind->background_rect),	    thdc,	    skind->background_rect.left,	    skind->background_rect.top,	    SRCCOPY);    // Draw buttons    for (i = 0; i < skind->m_num_buttons; i++) {	b = &skind->m_buttons[i];	prt = &b->rt[b->mode];	BitBlt (m_tempdc.hdc,	        b->dest.left,	        b->dest.top,	        WIDTH(b->dest),	        HEIGHT(b->dest),	        thdc,	        prt->left,	        prt->top,	        SRCCOPY);    }	    // Draw progress bar    if (m_prog_on) {	RECT rt = {m_prog_point.x, 		   m_prog_point.y, 		   m_prog_point.x + (WIDTH(m_prog_rect)*15) + 11,   // yummy magic numbers		   m_prog_point.y + HEIGHT(m_prog_rect)+4};	time_t now;	int num_bars;	int i;	time(&now);	num_bars = (now-m_time_start) % 15;	// number of bars to draw	FrameRect (m_tempdc.hdc, &rt, skind->hbrush);			for(i = 0; i < num_bars; i++) {	    BitBlt (m_tempdc.hdc,		    rt.left + (i * (WIDTH(m_prog_rect)+1)+2),		    rt.top+2,		    WIDTH(m_prog_rect),		    HEIGHT(m_prog_rect),		    thdc,		    m_prog_rect.left,		    m_prog_rect.top,		    SRCCOPY);	}    }    // Draw text data on the screen    SetBkMode (m_tempdc.hdc, TRANSPARENT); 	        // Draw text    SetTextColor (m_tempdc.hdc, skind->textcolor);    for (i = 0; i < IDR_NUMFIELDS; i++) {			TrimTextOut (m_tempdc.hdc, m_ddinfo[i].rt.left, 		     m_ddinfo[i].rt.top, 		     WIDTH(m_ddinfo[i].rt), 		     m_ddinfo[i].str);     }    debug_printf ("bltting: (%d %d)/n", 		    WIDTH (skind->background_rect),		    HEIGHT (skind->background_rect));    // Onto the actual screen     BitBlt (outhdc,	    0,	    0,//.........这里部分代码省略.........
开发者ID:dre-hh,项目名称:streamripper,代码行数:101,


示例3: OptionsProc

INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam){		switch(msg){	case WM_INITDIALOG:{		DWORD style;		g_opHdlg=hdlg;		bOptionsInit=TRUE;		TranslateDialogDefault(hdlg); 		if(g_iButtonsCount!=db_get_b(NULL, PLGNAME,"ButtonsCount", 0))		{			LOGFONT logFont;			HFONT hFont;			bNeedRestart=TRUE;			EnableWindow(GetDlgItem(hdlg,IDC_BUTTONSLIST),FALSE);			EnableWindow(GetDlgItem(hdlg,IDC_BLISTADD),FALSE);			EnableWindow(GetDlgItem(hdlg,IDC_BLISTREMOVE),FALSE);			EnableWindow(GetDlgItem(hdlg,IDC_MENUTREE),FALSE);			EnableWindow(GetDlgItem(hdlg,IDC_MTREEADD),FALSE);			EnableWindow(GetDlgItem(hdlg,IDC_MTREEREMOVE),FALSE);			EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),FALSE);			EnableWindow(GetDlgItem(hdlg,IDC_RCLICKVALUE),FALSE);			EnableWindow(GetDlgItem(hdlg,IDC_BUTTONNAME),FALSE);			EnableWindow(GetDlgItem(hdlg,IDC_INQMENU),FALSE);			EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),FALSE);			EnableWindow(GetDlgItem(hdlg,IDC_MENUNAME),FALSE);				ShowWindow(GetDlgItem(hdlg,IDC_WARNING),SW_SHOW);			hFont = (HFONT)SendDlgItemMessage(hdlg, IDC_WARNING, WM_GETFONT, 0, 0);			GetObject(hFont, sizeof(logFont), &logFont);			logFont.lfWeight = FW_BOLD;			hFont = CreateFontIndirect(&logFont);			SendDlgItemMessage(hdlg, IDC_WARNING, WM_SETFONT, (WPARAM)hFont, 0);			break;		}		g_iOPButtonsCount=g_iButtonsCount;		hButtonsList=GetDlgItem(hdlg,IDC_BUTTONSLIST);		hMenuTree=GetDlgItem(hdlg,IDC_MENUTREE);		style = GetWindowLongPtr(hButtonsList,GWL_STYLE);		style |=TVS_NOHSCROLL;		SetWindowLongPtr(hButtonsList,GWL_STYLE, style);		style = GetWindowLongPtr(hMenuTree,GWL_STYLE);		style |=TVS_NOHSCROLL;					SetWindowLongPtr(hMenuTree,GWL_STYLE, style);		BuildButtonsList(hButtonsList);		if (!TreeView_GetCount(hButtonsList))			EnableWindow(GetDlgItem(hdlg,IDC_RCLICKVALUE),FALSE);		mir_subclassWindow( GetDlgItem(hdlg,IDC_BUTTONNAME), EditSubclassProc);		mir_subclassWindow( GetDlgItem(hdlg,IDC_MENUNAME),   EditSubclassProc);		EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),FALSE);		EnableWindow(GetDlgItem(hdlg,IDC_INQMENU),FALSE);		EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),FALSE);		CheckDlgButton(hdlg,IDC_RAUTOSEND,(g_bRClickAuto=db_get_b(NULL,PLGNAME,"RClickAuto",0)) ? BST_CHECKED : BST_UNCHECKED);		CheckDlgButton(hdlg,IDC_LAUTOSEND,(g_bLClickAuto=db_get_b(NULL,PLGNAME,"LClickAuto",0)) ? BST_CHECKED : BST_UNCHECKED);		CheckDlgButton(hdlg,IDC_ENABLEQUICKMENU,(g_bQuickMenu=db_get_b(NULL, PLGNAME,"QuickMenu", 1)) ? BST_CHECKED : BST_UNCHECKED);		bOptionsInit=FALSE;							 }break;	case WM_LBUTTONUP:		if(drag) {			TVHITTESTINFO hti; 			HTREEITEM htiAfter=NULL;			ButtonData* bd=NULL;			TVITEM tvi;			RECT rc;			BYTE height;			BOOLEAN bAsChild = FALSE;			TreeView_SetInsertMark(hMenuTree, NULL, 0 );			ReleaseCapture();			SetCursor( LoadCursor( NULL, IDC_ARROW ));			hti.pt.x = ( SHORT )LOWORD( lparam );			hti.pt.y = ( SHORT )HIWORD( lparam );			ClientToScreen(hdlg,&hti.pt);			ScreenToClient(hMenuTree,&hti.pt);			TreeView_HitTest( hMenuTree, &hti );			if(TreeView_GetParent(hMenuTree,hti.hItem)&&TreeView_GetChild(hMenuTree,hDragItem))				break;			if(TreeView_GetChild(hMenuTree,hti.hItem)&&TreeView_GetChild(hMenuTree,hDragItem))				break;			if ( hti.flags & TVHT_ABOVE ) {				htiAfter = TVI_FIRST;			}			else				if ( hti.flags & ( TVHT_NOWHERE|TVHT_BELOW )) {					htiAfter = TVI_LAST;				}				else//.........这里部分代码省略.........
开发者ID:martok,项目名称:miranda-ng,代码行数:101,


示例4: MsgBoxProc

/** * This is the message procedure for my nice looking message box * * @param	hDlg		- window handle * @param	uMsg		- message to handle * @param	wParam		- message specific parameter * @param	lParam		- message specific parameter * * @return	TRUE, FALSE, IDOK, IDYES, IDALL, IDNO or IDCANCEL **/static INT_PTR CALLBACK MsgBoxProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam){	static int retOk = IDOK;	static int retAll = IDALL;	static int retNon = IDNONE;	static int retCancel = IDCANCEL;	switch (uMsg) {	case WM_INITDIALOG:		{			LPMSGBOX pMsgBox = (LPMSGBOX)lParam;			if (PtrIsValid(pMsgBox)) {				int icoWidth = 0;				int InfoBarHeight = 0;				HFONT hNormalFont;				hNormalFont = (HFONT)SendDlgItemMessage(hDlg, TXT_NAME, WM_GETFONT, 0, 0);				if (pMsgBox->uType & MB_INFOBAR) {					LOGFONT lf;					// set bold font for name in description area					GetObject(hNormalFont, sizeof(lf), &lf);					lf.lfWeight = FW_BOLD;					hNormalFont = CreateFontIndirect(&lf);					// set infobar's textfont					SendDlgItemMessage(hDlg, TXT_NAME, WM_SETFONT, (WPARAM)hNormalFont, 0);					// set infobar's logo icon					SendDlgItemMessage(hDlg, ICO_DLGLOGO, STM_SETIMAGE, IMAGE_ICON,						(pMsgBox->hiLogo ? (LPARAM)pMsgBox->hiLogo : (LPARAM)IcoLib_GetIcon(ICO_DLG_DETAILS)));					// enable headerbar					ShowWindow(GetDlgItem(hDlg, TXT_NAME), SW_SHOW);					ShowWindow(GetDlgItem(hDlg, ICO_DLGLOGO), SW_SHOW);				}				else {					RECT rc;					GetClientRect(GetDlgItem(hDlg, TXT_NAME), &rc);					InfoBarHeight = rc.bottom;					if (pMsgBox->hiLogo)						SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM)pMsgBox->hiLogo);				}				// draw the desired status icon				HICON hIcon = MsgLoadIcon(pMsgBox);				if (hIcon)					SendDlgItemMessage(hDlg, ICO_MSGDLG, STM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);				else {					RECT ws;					GetWindowRect(GetDlgItem(hDlg, ICO_MSGDLG), &ws);					icoWidth = ws.right - ws.left;					ShowWindow(GetDlgItem(hDlg, ICO_MSGDLG), SW_HIDE);				}				// resize the messagebox and reorganize the buttons				if (HDC hDC = GetDC(hDlg)) {					POINT mpt = { 0, 0 };					RECT ws = { 0, 0, 0, 0 };					int txtWidth = 0, txtHeight = 0, needX, needY;					RECT rcDlg;					SIZE ts;					LPTSTR h, rs;					SelectObject(hDC, hNormalFont);					// get message text width and height					if (pMsgBox->ptszMsg) for (rs = h = pMsgBox->ptszMsg;; ++h) {						if (*h == '/n' || !*h) {							GetTextExtentPoint32(hDC, rs, h - rs, &ts);							if (ts.cx > txtWidth)								txtWidth = ts.cx;							txtHeight += ts.cy;							if (!*h)								break;							rs = h + 1;						}					}					// increase width if info text requires more					if ((pMsgBox->uType&MB_INFOBAR) && pMsgBox->ptszInfoText && *pMsgBox->ptszInfoText) {						int multiline = 0;						RECT rcico; GetClientRect(GetDlgItem(hDlg, ICO_DLGLOGO), &rcico);						rcico.right = rcico.right * 100 / 66; // padding						for (rs = h = pMsgBox->ptszInfoText;; ++h) {							if (*h == '/n' || !*h) {								GetTextExtentPoint32(hDC, rs, h - rs, &ts);								ts.cx += rcico.right;								if (ts.cx > txtWidth)									txtWidth = ts.cx;								if (!*h)//.........这里部分代码省略.........
开发者ID:kxepal,项目名称:miranda-ng,代码行数:101,


示例5: memset

	void PropSheet::Show(HINSTANCE hInstance, HWND hParent, std::string title, int startpage, bool floating, bool wizard)	{			HPROPSHEETPAGE *pages = new HPROPSHEETPAGE[list.size()];		PROPSHEETPAGE page;		//common settings		memset((void*)&page,0,sizeof(PROPSHEETPAGE));		page.dwSize = sizeof(PROPSHEETPAGE);		page.hInstance = hInstance;		int i=0;		for (DlgList::iterator iter = list.begin(); iter != list.end(); iter++, i++)		{			if (wizard)			{				if (i == 0 || i == list.size()-1)					page.dwFlags = PSP_HIDEHEADER;				else					page.dwFlags = PSP_USEHEADERTITLE|PSP_USEHEADERSUBTITLE;			}			else			{				page.dwFlags = PSP_USETITLE;			}			page.pszTemplate = iter->resource;			page.pfnDlgProc = Tab::TabDlgProc;			page.pszTitle = iter->title;			page.pszHeaderTitle = wizard?iter->title:0;			page.pszHeaderSubTitle = wizard?iter->hdrSubTitle:0;			page.lParam = (LPARAM)iter->tab;			pages[i] = CreatePropertySheetPage(&page);		}		PROPSHEETHEADER sheet;		memset(&sheet,0,sizeof(sheet));		sheet.dwSize = sizeof(PROPSHEETHEADER);		sheet.hInstance = hInstance;		sheet.hwndParent = hParent;		sheet.pszbmWatermark = watermark;		sheet.pszbmHeader = header;				if (icon)			sheet.hIcon = icon;		if (wizard)			sheet.dwFlags = PSH_USECALLBACK | PSH_WIZARD97 | (watermark?PSH_WATERMARK:0) | (header?PSH_HEADER:0);		else			sheet.dwFlags = PSH_USECALLBACK | PSH_PROPTITLE;		if (floating)			sheet.dwFlags |= PSH_MODELESS;		//else		//	sheet.dwFlags |= PSH_NOAPPLYNOW;		if (icon) 			sheet.dwFlags |= PSH_USEHICON;		sheet.pszCaption = ConvertUTF8ToWString(title).c_str();		sheet.nPages = (UINT)list.size();		sheet.phpage = pages;		sheet.nStartPage = startpage;		sheet.pfnCallback = (PFNPROPSHEETCALLBACK)Callback;				if (wizard)		{			NONCLIENTMETRICS ncm = {0};			ncm.cbSize = sizeof(ncm);			SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);			//Create the intro/end title font			LOGFONT TitleLogFont = ncm.lfMessageFont;			TitleLogFont.lfWeight = FW_BOLD;			lstrcpy(TitleLogFont.lfFaceName, TEXT("Verdana Bold"));			//StringCchCopy(TitleLogFont.lfFaceName, 32, TEXT("Verdana Bold"));			HDC hdc = GetDC(NULL); //gets the screen DC			INT FontSize = 12;			TitleLogFont.lfHeight = 0 - GetDeviceCaps(hdc, LOGPIXELSY) * FontSize / 72;			hTitleFont = CreateFontIndirect(&TitleLogFont);			ReleaseDC(NULL, hdc);		}		else			hTitleFont = 0;		centered=false;		PropertySheet(&sheet);		if (!floating)		{			for (DlgList::iterator iter = list.begin(); iter != list.end(); iter++)			{				delete iter->tab;			}			DeleteObject(hTitleFont);		}		delete [] pages;	}
开发者ID:18859966862,项目名称:ppsspp,代码行数:95,


示例6: InfoDialogBoxProc

BOOL CALLBACK InfoDialogBoxProc( HWND hWnd, UINT wmes, UINT wparam, LONG lparam ){	int		i;	switch( wmes ){	  case WM_INITDIALOG:		{			char	buf[1024];			int		device=0;			CheckCPU();			buf[0]='/0';			strcatfn( buf, "VenderID %s", szVenderID );			strcatfn( buf, "TypeID %d, FamilyID %d, ModelID %d, SteppingID %d", TypeID, FamilyID, ModelID, SteppingID);			strcatfn( buf, "%s", szCpuName );			strcatfn( buf, "CpuClock
C++ CreateFontIndirectW函数代码示例
C++ CreateFilter函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。