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


C++ CreateFontIndirect函数代码示例

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


在下文中一共展示了CreateFontIndirect函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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,代码来源:cpicture_121.c

示例2: internal_render_do_paint

static BOOL
internal_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,代码来源:render.c

示例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,代码来源:options.cpp

示例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,代码来源:dlg_msgbox.cpp

示例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,代码来源:PropertySheet.cpp

示例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実測値 %dMHz", fCpuClock );

			strcatfn( buf, "MMX  %s", (MMX_Flag)?"有":"無" );
			strcatfn( buf, "SSE  %s", (SSE_FP_Flag)?"有":"無" );
			strcatfn( buf, "SSE2  %s", (SSE2_Flag)?"有":"無" );
			strcatfn( buf, "3DNow!  %s", (_3DNow_Flag)?"有":"無" );
			strcatfn( buf, "e3DNow!  %s", (_3DNowExt_Flag)?"有":"無" );
			strcatfn( buf, "" );
			
			device = EnumGraphicsDevice(  );
			for( i=0 ; i<device ; i++ ){
				strcatfn( buf, "VideoCard(%d) %s", i+1, GetGraphicsDeviceName(i) );
			}
			device = EnumSoundDevice();
			for( i=0 ; i<device ; i++ ){
				strcatfn( buf, "SoundCard(%d) %s", i+1, GetSoundDeviceName(i) );
			}

			strcatfn( buf, "" );
			strcatfn( buf, "OS %s", GetOSName() );

			SetDlgItemText( hWnd, IDC_EDIT1, buf );

			LOGFONT logfont;
			hFontLink=(HFONT)SendMessage(GetDlgItem(hWnd,IDC_WWW),WM_GETFONT,0,0);
			GetObject(hFontLink,sizeof(logfont),&logfont);
			logfont.lfUnderline=1;
			hFontLink=CreateFontIndirect(&logfont);
			SendDlgItemMessage(hWnd,IDC_WWW,WM_SETFONT,(WPARAM)hFontLink,0);
			oldLinkProc = (WNDPROC)GetWindowLong(GetDlgItem(hWnd,IDC_WWW),GWL_WNDPROC);
			SetWindowLong(GetDlgItem(hWnd,IDC_WWW),GWL_WNDPROC,(LONG)linkProc);
			return TRUE;
		}
		break;
	  case WM_COMMAND:
		switch( LOWORD( wparam ) ){
			case IDC_WWW:
				if(HIWORD(wparam) == STN_CLICKED){
					char szTextTmp[100];
					GetDlgItemText(hWnd,LOWORD(wparam),szTextTmp,100);
					ShellExecute(hWnd,NULL,szTextTmp,NULL,NULL,SW_SHOWNORMAL);
				}
				break;
		}
		break;
	  case WM_DESTROY:
		DeleteObject(hFontLink);
		break;
	}
	return FALSE;
} // InfoDialogBoxProc
开发者ID:autch,项目名称:aquaplus_gpl,代码行数:64,代码来源:SetResource.cpp

示例7: GetFontSettingFromDB

int GetFontSettingFromDB(char *settings_group, char *prefix, LOGFONT* lf, COLORREF * colour, DWORD flags)
{
	DBVARIANT dbv;
	char idstr[256];
	BYTE style;
	int retval = 0;

	GetDefaultFontSetting(lf, colour);

	if (flags & FIDF_APPENDNAME) mir_snprintf(idstr, SIZEOF(idstr), "%sName", prefix);
	else mir_snprintf(idstr, SIZEOF(idstr), "%s", prefix);

	if (!db_get_ts(NULL, settings_group, idstr, &dbv)) {
		_tcscpy(lf->lfFaceName, dbv.ptszVal);
		db_free(&dbv);
	}
	else retval = 1;

	if (colour) {
		mir_snprintf(idstr, SIZEOF(idstr), "%sCol", prefix);
		*colour = db_get_dw(NULL, settings_group, idstr, *colour);
	}

	mir_snprintf(idstr, SIZEOF(idstr), "%sSize", prefix);
	lf->lfHeight = (char)db_get_b(NULL, settings_group, idstr, lf->lfHeight);

	//wsprintf(idstr, "%sFlags", prefix);
	//if (db_get_dw(NULL, settings_group, idstr, 0) & FIDF_SAVEACTUALHEIGHT) {
	//	HDC hdc = GetDC(0);
	//	lf->lfHeight = -lf->lfHeight;
	//	ReleaseDC(0, hdc);
	//}

	mir_snprintf(idstr, SIZEOF(idstr), "%sSty", prefix);
	style = (BYTE) db_get_b(NULL, settings_group, idstr,
		(lf->lfWeight == FW_NORMAL ? 0 : DBFONTF_BOLD) | (lf->lfItalic ? DBFONTF_ITALIC : 0) | (lf->lfUnderline ? DBFONTF_UNDERLINE : 0) | lf->lfStrikeOut ? DBFONTF_STRIKEOUT : 0);

	lf->lfWidth = lf->lfEscapement = lf->lfOrientation = 0;
	lf->lfWeight = style & DBFONTF_BOLD ? FW_BOLD : FW_NORMAL;
	lf->lfItalic = (style & DBFONTF_ITALIC) != 0;
	lf->lfUnderline = (style & DBFONTF_UNDERLINE) != 0;
	lf->lfStrikeOut = (style & DBFONTF_STRIKEOUT) != 0;

	mir_snprintf(idstr, SIZEOF(idstr), "%sSet", prefix);
	lf->lfCharSet = db_get_b(NULL, settings_group, idstr, lf->lfCharSet);

	lf->lfOutPrecision = OUT_DEFAULT_PRECIS;
	lf->lfClipPrecision = CLIP_DEFAULT_PRECIS;
	lf->lfQuality = DEFAULT_QUALITY;
	lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;

	if (lf->lfHeight > 0) {
		HDC hdc = GetDC(0);
		if (flags & FIDF_SAVEPOINTSIZE) {
			lf->lfHeight = -MulDiv(lf->lfHeight, GetDeviceCaps(hdc, LOGPIXELSY), 72);
		} else { // assume SAVEACTUALHEIGHT
			TEXTMETRIC tm;
			HFONT hFont = CreateFontIndirect(lf);
			HFONT hOldFont = (HFONT)SelectObject(hdc, hFont);

			GetTextMetrics(hdc, &tm);

			lf->lfHeight = -(lf->lfHeight - tm.tmInternalLeading);

			SelectObject(hdc, hOldFont);
			DeleteObject(hFont);
		}
		//lf->lfHeight = -MulDiv(lf->lfHeight, GetDeviceCaps(hdc, LOGPIXELSY), 72);
		ReleaseDC(0, hdc);
	}

	return retval;
}
开发者ID:Ganster41,项目名称:miranda-ng,代码行数:73,代码来源:services.cpp

示例8: switch

LRESULT CALLBACK CSkeletalViewerApp::WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch(message)
    {
        case WM_INITDIALOG:
        {
            LOGFONT lf;

            // Clean state the class
            Nui_Zero();

            // Bind application window handle
            m_hWnd=hWnd;

            // Initialize and start NUI processing
            Nui_Init();

            // Set the font for Frames Per Second
            GetObject((HFONT) GetStockObject(DEFAULT_GUI_FONT),sizeof(lf),&lf);
            lf.lfHeight*=4;
            m_hFontFPS=CreateFontIndirect(&lf);
            SendDlgItemMessage(hWnd,IDC_FPS,WM_SETFONT,(WPARAM) m_hFontFPS,0);
			// Use the same font for distance and user
			SendDlgItemMessage(hWnd,IDC_DISTANCE,WM_SETFONT,(WPARAM) m_hFontFPS,0);
			SendDlgItemMessage(hWnd,IDC_USER,WM_SETFONT,(WPARAM) m_hFontFPS,0);

            UpdateComboBox();
            SendDlgItemMessage (m_hWnd, IDC_CAMERAS, CB_SETCURSEL, 0, 0);
        }
        break;

        case WM_USER_UPDATE_FPS:
        {
            ::SetDlgItemInt( m_hWnd, static_cast<int>(wParam), static_cast<int>(lParam), FALSE );
        }
        break;
		case WM_USER_UPDATE_DISTANCE:
        {
            ::SetDlgItemInt( m_hWnd, static_cast<int>(wParam), static_cast<int>(lParam), FALSE );
        }
        break;
		case WM_USER_UPDATE_USER:
        {
            ::SetDlgItemInt( m_hWnd, static_cast<int>(wParam), static_cast<int>(lParam), FALSE );
        }
        break;
        case WM_USER_UPDATE_COMBO:
        {
            UpdateComboBox();
        }
        break;
        case WM_COMMAND:
        if( HIWORD( wParam ) == CBN_SELCHANGE )
        {
            LRESULT index = ::SendDlgItemMessage(m_hWnd, IDC_CAMERAS, CB_GETCURSEL, 0, 0);
            switch (LOWORD(wParam))
            {
            case IDC_CAMERAS:
                {
                    if (!m_fUpdatingUi) // Don't reconnect as a result of updating the combo box.
                    {
                        Nui_UnInit();
                        Nui_Zero();
                        Nui_Init(static_cast<int>(index));
                    }
                }
            break;
            }
        }
        break;
		// Handle key presses
		case WM_KEYUP:
			switch (wParam)
			{
			default:
				// Print the info about the key I just pressed
				char msg[1024];
				sprintf_s (msg, 1024, "wParam: %s lParam: %s", wParam, lParam);
				WCHAR msg_u[1024];
				MultiByteToWideChar(0, 0, msg, 1024, msg_u, 6);
				MessageBox(hWnd, msg_u, TEXT("Display pressed character"), NULL);
			}
			break;
        // If the titlebar X is clicked destroy app
        case WM_CLOSE:
            DestroyWindow(hWnd);
            break;

        case WM_DESTROY:
            // Uninitialize NUI
            Nui_UnInit();

            // Other cleanup
            DeleteObject(m_hFontFPS);

            // Quit the main message pump
            PostQuitMessage(0);
            break;
    }
    return (FALSE);
//.........这里部分代码省略.........
开发者ID:RayzorFlash,项目名称:kinectUI,代码行数:101,代码来源:SkeletalViewer.cpp

示例9: Setup

//
// Framework functions
//
bool Setup()
{
	//
	// Get a handle to a device context.
	//
	HDC hdc = CreateCompatibleDC( 0 );
    HFONT hFont;
    HFONT hFontOld;

	//
	// Describe the font we want.
	//

    LOGFONT lf;
	ZeroMemory(&lf, sizeof(LOGFONT));

	lf.lfHeight         = 25;    // in logical units
	lf.lfWidth          = 12;    // in logical units
	lf.lfEscapement     = 0;        
	lf.lfOrientation    = 0;     
	lf.lfWeight         = 500;   // boldness, range 0(light) - 1000(bold)
	lf.lfItalic         = false;   
	lf.lfUnderline      = false;    
	lf.lfStrikeOut      = false;    
	lf.lfCharSet        = DEFAULT_CHARSET;
	lf.lfOutPrecision   = 0;              
	lf.lfClipPrecision  = 0;          
	lf.lfQuality        = 0;           
	lf.lfPitchAndFamily = 0;    
	strcpy(lf.lfFaceName, "Times New Roman"); // font style

	//
	// Create the font and select it with the device context.
	//
    hFont = CreateFontIndirect(&lf);
    hFontOld = (HFONT)SelectObject(hdc, hFont); 

	//
	// Create the text mesh based on the selected font in the HDC.
	//
    D3DXCreateText(Device, hdc, "Direct3D", 
        0.001f, 0.1f, &Text, 0, 0);

	//
	// Restore the old font and free the acquired HDC.
	//
    SelectObject(hdc, hFontOld);
    DeleteObject( hFont );
    DeleteDC( hdc );

	//
	// Lights.
	//

	D3DXVECTOR3 dir(0.0f, -0.5f, 1.0f);
	D3DXCOLOR col = d3d::WHITE;
	D3DLIGHT9 light = d3d::InitDirectionalLight(&dir, &col);

	Device->SetLight(0, &light);
	Device->LightEnable(0, true);

	Device->SetRenderState(D3DRS_NORMALIZENORMALS, true);
	Device->SetRenderState(D3DRS_SPECULARENABLE, true);

	//
	// Set camera.
	//

	D3DXVECTOR3 pos(0.0f, 1.5f, -3.3f);
	D3DXVECTOR3 target(0.0f, 0.0f, 0.0f);
	D3DXVECTOR3 up(0.0f, 1.0f, 0.0f);

	D3DXMATRIX V;
	D3DXMatrixLookAtLH(
		&V,
		&pos,
		&target,
		&up);

	Device->SetTransform(D3DTS_VIEW, &V);

	//
	// Set projection matrix.
	//

	D3DXMATRIX proj;
	D3DXMatrixPerspectiveFovLH(
			&proj,
			D3DX_PI * 0.25f, // 45 - degree
			(float)Width / (float)Height,
			0.01f,
			1000.0f);
	Device->SetTransform(D3DTS_PROJECTION, &proj);

	return true;
}
开发者ID:as2120,项目名称:ZNginx,代码行数:99,代码来源:d3dxcreatetext.cpp

示例10: TRACE


//.........这里部分代码省略.........
			{
				// there's another tag
				_tcsncpy(pszText1, pszText, cp - pszText);
				pszText1[cp-pszText] = _T('\0');
				TRACE(_T("pszText1=<%s>\n"), pszText1);

				if (_tcslen(pszText1) <= 0)
				{
					if (_tcslen(pszText) != 0)
					{
						_tcscpy(pszText1, pszText);
						n -= 1;
					}
				}
				pszText = cp;
			}
			else
			{
				// no more html tags
				_tcscpy(pszText1, pszText);
				pszText = NULL;
			}
		}
		TRACE(_T("pszText=<%s>\n"), pszText);
		TRACE(_T("pszText1=<%s>\n"), pszText1);

		// create new font ------------------------------------------

		lf.lfWeight    = bBold ? FW_BOLD : FW_NORMAL;
		lf.lfUnderline = (BYTE) bUnderline;
		lf.lfItalic    = (BYTE) bItalic;
		lf.lfStrikeOut = (BYTE) bStrikeThrough;

		HFONT hNewFont = CreateFontIndirect(&lf);
		_ASSERTE(hNewFont);

		HFONT hOldFont = (HFONT) SelectObject(hMemDC, hNewFont);

		SetTextColor(hMemDC, crTextNew);
		if (pXHDS->crTextBackground != COLOR_NONE)
			SetBkColor(hMemDC, pXHDS->crTextBackground);
		else
			SetBkMode(hMemDC, TRANSPARENT);		// need transparency for italic fonts

		// replace char entities ------------------------------------

		size_t end = _tcslen(pszText1);
		buflen = end + 100;
		_ASSERTE(buf == NULL);
		buf = new TCHAR [buflen];
		memset(buf, 0, buflen*sizeof(TCHAR));

		_tcsncpy(buf, pszText1, buflen-1);

		ReplaceCharEntities(buf, end);

		int len = (int)_tcslen(buf);
		SIZE size;
		GetTextExtentPoint32(hMemDC, buf, len, &size);
		LONG width = size.cx;

		if ((crBkgndNew != crBackground) &&
			(pXHDS->crTextBackground == COLOR_NONE))
		{
			// changing backgrounds, so fill in with new color
			HBRUSH hbrushnew = CreateSolidBrush(crBkgndNew); 
开发者ID:RNCan,项目名称:WeatherBasedSimulationFramework,代码行数:67,代码来源:XHtmlDraw.cpp

示例11: sizeof

void TabBarPlus::init(HINSTANCE hInst, HWND parent, bool isVertical, bool isTraditional, bool isMultiLine)
{
	Window::init(hInst, parent);
	int vertical = isVertical?(TCS_VERTICAL | TCS_MULTILINE | TCS_RIGHTJUSTIFY):0;
	_isTraditional = isTraditional;
	_isVertical = isVertical;
	_isMultiLine = isMultiLine;

	INITCOMMONCONTROLSEX icce;
	icce.dwSize = sizeof(icce);
	icce.dwICC = ICC_TAB_CLASSES;
	InitCommonControlsEx(&icce);
    int multiLine = isMultiLine?(_isTraditional?TCS_MULTILINE:0):0;

	int style = WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE |\
        TCS_FOCUSNEVER | TCS_TABS | vertical | multiLine;

	style |= TCS_OWNERDRAWFIXED;

	_hSelf = ::CreateWindowEx(
				0,
				WC_TABCONTROL,
				TEXT("Tab"),
				style,
				0, 0, 0, 0,
				_hParent,
				NULL,
				_hInst,
				0);

	if (!_hSelf)
	{
		throw std::runtime_error("TabBarPlus::init : CreateWindowEx() function return null");
	}

	_tooltips = ::CreateWindowEx(
		0,
		TOOLTIPS_CLASS,
		NULL,
		TTS_ALWAYSTIP | TTS_NOPREFIX,
		0, 0, 0, 0,
		_hParent,
		NULL,
		_hInst,
		0);
	if (!_tooltips)
	{
		throw std::runtime_error("TabBarPlus::init : tooltip CreateWindowEx() function return null");
	}
	::SendMessage(_hSelf, TCM_SETTOOLTIPS, (WPARAM)_tooltips, 0);

	if (!_isTraditional)
    {
		if (!_hwndArray[_nbCtrl])
		{
			_hwndArray[_nbCtrl] = _hSelf;
			_ctrlID = _nbCtrl;
		}
		else
		{
			int i = 0;
			bool found = false;
			for ( ; i < nbCtrlMax && !found ; ++i)
				if (!_hwndArray[i])
					found = true;
			if (!found)
			{
				_ctrlID = -1;
				destroy();
				throw std::runtime_error("TabBarPlus::init : Tab Control error - Tab Control # is over its limit");
			}
			_hwndArray[i] = _hSelf;
			_ctrlID = i;
		}
		++_nbCtrl;

        ::SetWindowLongPtr(_hSelf, GWLP_USERDATA, (LONG_PTR)this);
	    _tabBarDefaultProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(_hSelf, GWLP_WNDPROC, (LONG_PTR)TabBarPlus_Proc));
    }

	LOGFONT LogFont;

	_hFont = (HFONT)::SendMessage(_hSelf, WM_GETFONT, 0, 0);

	if (_hFont == NULL)
		_hFont = (HFONT)::GetStockObject(DEFAULT_GUI_FONT);

	if (_hLargeFont == NULL)
		_hLargeFont = (HFONT)::GetStockObject(SYSTEM_FONT);

	if (::GetObject(_hFont, sizeof(LOGFONT), &LogFont) != 0)
	{
		LogFont.lfEscapement  = 900;
		LogFont.lfOrientation = 900;
		_hVerticalFont = CreateFontIndirect(&LogFont);

		LogFont.lfWeight = 900;
		_hVerticalLargeFont = CreateFontIndirect(&LogFont);
	}
}
开发者ID:wikemang,项目名称:notepad-plus-plus,代码行数:100,代码来源:TabBar.cpp

示例12: DestroyIcon

void Win32TaskbarManager::setCount(int count) {
	if (_taskbar == NULL)
		return;

	if (count == 0) {
		_taskbar->SetOverlayIcon(getHwnd(), NULL, L"");
		return;
	}

	// FIXME: This isn't really nice and could use a cleanup.
	//        The only good thing is that it doesn't use GDI+
	//        and thus does not have a dependancy on it,
	//        with the downside of being a lot more ugly.
	//        Maybe replace it by a Graphic::Surface, use
	//        ScummVM font drawing and extract the contents at
	//        the end?

	if (_count != count || _icon == NULL) {
		// Cleanup previous icon
		_count = count;
		if (_icon)
			DestroyIcon(_icon);

		Common::String countString = (count < 100 ? Common::String::format("%d", count) : "9+");

		// Create transparent background
		BITMAPV5HEADER bi;
		ZeroMemory(&bi, sizeof(BITMAPV5HEADER));
		bi.bV5Size        = sizeof(BITMAPV5HEADER);
		bi.bV5Width       = 16;
		bi.bV5Height      = 16;
		bi.bV5Planes      = 1;
		bi.bV5BitCount    = 32;
		bi.bV5Compression = BI_RGB;
		// Set 32 BPP alpha format
		bi.bV5RedMask     = 0x00FF0000;
		bi.bV5GreenMask   = 0x0000FF00;
		bi.bV5BlueMask    = 0x000000FF;
		bi.bV5AlphaMask   = 0xFF000000;

		// Get DC
		HDC hdc;
		hdc = GetDC(NULL);
		HDC hMemDC = CreateCompatibleDC(hdc);
		ReleaseDC(NULL, hdc);

		// Create a bitmap mask
		HBITMAP hBitmapMask = CreateBitmap(16, 16, 1, 1, NULL);

		// Create the DIB section with an alpha channel
		void *lpBits;
		HBITMAP hBitmap = CreateDIBSection(hdc, (BITMAPINFO *)&bi, DIB_RGB_COLORS, (void **)&lpBits, NULL, 0);
		HBITMAP hOldBitmap = (HBITMAP)SelectObject(hMemDC, hBitmap);

		// Load the icon background
		HICON hIconBackground = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(1002 /* IDI_COUNT */));
		DrawIconEx(hMemDC, 0, 0, hIconBackground, 16, 16, 0, 0, DI_NORMAL);
		DeleteObject(hIconBackground);

		// Draw the count
		LOGFONT lFont;
		memset(&lFont, 0, sizeof(LOGFONT));
		lFont.lfHeight = 10;
		lFont.lfWeight = FW_BOLD;
		lFont.lfItalic = 1;
		strcpy(lFont.lfFaceName, "Arial");

		HFONT hFont = CreateFontIndirect(&lFont);
		SelectObject(hMemDC, hFont);

		RECT rect;
		SetRect(&rect, 4, 4, 12, 12);
		SetTextColor(hMemDC, RGB(48, 48, 48));
		SetBkMode(hMemDC, TRANSPARENT);
		DrawText(hMemDC, countString.c_str(), -1, &rect, DT_NOCLIP|DT_CENTER);

		// Set the text alpha to fully opaque (we consider the data inside the text rect)
		DWORD *lpdwPixel = (DWORD *)lpBits;
		for (int x = 3; x < 12; x++) {
			for(int y = 3; y < 12; y++) {
				unsigned char *p = (unsigned char *)(lpdwPixel + x * 16 + y);

				if (p[0] != 0 && p[1] != 0 && p[2] != 0)
					p[3] = 255;
			}
		}

		// Cleanup DC
		DeleteObject(hFont);
		SelectObject(hMemDC, hOldBitmap);
		DeleteDC(hMemDC);

		// Prepare our new icon
		ICONINFO ii;
		ii.fIcon    = FALSE;
		ii.xHotspot = 0;
		ii.yHotspot = 0;
		ii.hbmMask  = hBitmapMask;
		ii.hbmColor = hBitmap;

//.........这里部分代码省略.........
开发者ID:Deledrius,项目名称:residual,代码行数:101,代码来源:win32-taskbar.cpp

示例13: CreateWindowEx

int CBrowseFolder::BrowseCallBackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM /*lpData*/)
{
	RECT ListViewRect,Dialog;
	//Initialization callback message
	if (uMsg == BFFM_INITIALIZED)
	{
		if (_tcslen(m_CheckText) > 0)
		{
			bool bSecondCheckbox = (_tcslen(m_CheckText2)!=0);
			//Rectangles for getting the positions
			checkbox = CreateWindowEx(	0,
				_T("BUTTON"),
				m_CheckText,
				WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN|BS_AUTOCHECKBOX,
				0,100,100,50,
				hwnd,
				0,
				NULL,
				NULL);
			if (checkbox == NULL)
				return 0;

			if (bSecondCheckbox)
			{
				//Rectangles for getting the positions
				checkbox2 = CreateWindowEx(	0,
					_T("BUTTON"),
					m_CheckText2,
					WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN|BS_AUTOCHECKBOX,
					0,100,100,50,
					hwnd,
					0,
					NULL,
					NULL);
				if (checkbox2 == NULL)
					return 0;
			}

			ListView = FindWindowEx(hwnd,NULL,_T("SysTreeView32"),NULL);
			if (ListView == NULL)
				ListView = FindWindowEx(hwnd,NULL,_T("SHBrowseForFolder ShellNameSpace Control"),NULL);

			if (ListView == NULL)
				return 0;

			//Gets the dimensions of the windows
			const int controlHeight = ::GetSystemMetrics(SM_CYMENUCHECK) + 4;
			GetWindowRect(hwnd,&Dialog);
			GetWindowRect(ListView,&ListViewRect);
			POINT pt;
			pt.x = ListViewRect.left;
			pt.y = ListViewRect.top;
			ScreenToClient(hwnd, &pt);
			ListViewRect.top = pt.y;
			ListViewRect.left = pt.x;
			pt.x = ListViewRect.right;
			pt.y = ListViewRect.bottom;
			ScreenToClient(hwnd, &pt);
			ListViewRect.bottom = pt.y;
			ListViewRect.right = pt.x;
			//Sets the list view controls dimensions
			SetWindowPos(ListView,0,ListViewRect.left,
				bSecondCheckbox ? ListViewRect.top+(2*controlHeight) : ListViewRect.top+controlHeight,
				(ListViewRect.right-ListViewRect.left),
				bSecondCheckbox ? (ListViewRect.bottom - ListViewRect.top)-(2*controlHeight) : (ListViewRect.bottom - ListViewRect.top)-controlHeight,
				SWP_NOZORDER);
			//Sets the window positions of checkbox and dialog controls
			SetWindowPos(checkbox,HWND_BOTTOM,ListViewRect.left,
				ListViewRect.top,
				(ListViewRect.right-ListViewRect.left),
				controlHeight,
				SWP_NOZORDER);
			if (bSecondCheckbox)
			{
				SetWindowPos(checkbox2,HWND_BOTTOM,ListViewRect.left,
					ListViewRect.top+controlHeight,
					(ListViewRect.right-ListViewRect.left),
					controlHeight,
					SWP_NOZORDER);
			}
			HWND label = FindWindowEx(hwnd, NULL, _T("STATIC"), NULL);
			if (label)
			{
				HFONT hFont = (HFONT)::SendMessage(label, WM_GETFONT, 0, 0);
				LOGFONT lf = {0};
				GetObject(hFont, sizeof(lf), &lf);
				HFONT hf2 = CreateFontIndirect(&lf);
				::SendMessage(checkbox, WM_SETFONT, (WPARAM)hf2, TRUE);
				if (bSecondCheckbox)
					::SendMessage(checkbox2, WM_SETFONT, (WPARAM)hf2, TRUE);
			}
			else
			{
				//Sets the fonts of static controls
				SetFont(checkbox,_T("MS Sans Serif"),12);
				if (bSecondCheckbox)
					SetFont(checkbox2,_T("MS Sans Serif"),12);
			}

			// Subclass the checkbox control. 
//.........这里部分代码省略.........
开发者ID:fatterbetter,项目名称:ZTools,代码行数:101,代码来源:BrowseFolder.cpp

示例14: WindowSetIcon

void CJabberDlgGcJoin::OnInitDialog()
{
	CSuper::OnInitDialog();

	WindowSetIcon(m_hwnd, m_proto, "group");

	JabberGcRecentInfo *pInfo = NULL;
	if (m_jid)
		pInfo = new JabberGcRecentInfo(m_proto, m_jid);
	else if(OpenClipboard(m_hwnd)) {
		HANDLE hData = GetClipboardData(CF_UNICODETEXT);

		if (hData) {
			TCHAR *buf = (TCHAR *)GlobalLock(hData);
			if (buf && _tcschr(buf, _T('@')) && !_tcschr(buf, _T(' ')))
				pInfo = new JabberGcRecentInfo(m_proto, buf);
			GlobalUnlock(hData);
		}
		CloseClipboard();
	}

	if (pInfo) {
		pInfo->fillForm(m_hwnd);
		delete pInfo;
	}

	ptrT tszNick(m_proto->getTStringA("Nick"));
	if (tszNick == NULL)
		tszNick = JabberNickFromJID(m_proto->m_szJabberJID);
	SetDlgItemText(m_hwnd, IDC_NICK, tszNick);

	TEXTMETRIC tm = { 0 };
	HDC hdc = GetDC(m_hwnd);
	GetTextMetrics(hdc, &tm);
	ReleaseDC(m_hwnd, hdc);
	sttTextLineHeight = tm.tmHeight;
	SendDlgItemMessage(m_hwnd, IDC_ROOM, CB_SETITEMHEIGHT, -1, sttTextLineHeight - 1);

	LOGFONT lf = { 0 };
	HFONT hfnt = (HFONT)SendDlgItemMessage(m_hwnd, IDC_TXT_RECENT, WM_GETFONT, 0, 0);
	GetObject(hfnt, sizeof(lf), &lf);
	lf.lfWeight = FW_BOLD;
	SendDlgItemMessage(m_hwnd, IDC_TXT_RECENT, WM_SETFONT, (WPARAM)CreateFontIndirect(&lf), TRUE);

	SendDlgItemMessage(m_hwnd, IDC_BOOKMARKS, BM_SETIMAGE, IMAGE_ICON, (LPARAM)m_proto->LoadIconEx("bookmarks"));
	SendDlgItemMessage(m_hwnd, IDC_BOOKMARKS, BUTTONSETASFLATBTN, TRUE, 0);
	SendDlgItemMessage(m_hwnd, IDC_BOOKMARKS, BUTTONADDTOOLTIP, (WPARAM)"Bookmarks", 0);
	SendDlgItemMessage(m_hwnd, IDC_BOOKMARKS, BUTTONSETASPUSHBTN, TRUE, 0);

	m_proto->ComboLoadRecentStrings(m_hwnd, IDC_SERVER, "joinWnd_rcSvr");

	int i;
	for (i = 0; i < 5; i++) {
		TCHAR jid[JABBER_MAX_JID_LEN];
		JabberGcRecentInfo info(m_proto);
		if (!info.loadRecent(i))
			break;

		mir_sntprintf(jid, _T("%[email protected]%s (%s)"), info.m_room, info.m_server, info.m_nick ? info.m_nick : TranslateT("<no nick>"));
		SetDlgItemText(m_hwnd, IDC_RECENT1 + i, jid);
	}
	sttJoinDlgShowRecentItems(m_hwnd, i);
}
开发者ID:Seldom,项目名称:miranda-ng,代码行数:63,代码来源:jabber_groupchat.cpp

示例15: switch

INT_PTR CALLBACK CConfig::AppearanceDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	switch (uMsg)
	{
		case WM_INITDIALOG:
		{
			m_bInitializingDialog = true;
			
			// Translate the dialog
			TranslateDialogDefault(hwndDlg);

			CheckDlgButton(hwndDlg, IDC_SKIP_DRIVER_ERROR,		m_abBoolSettings[SKIP_DRIVER_ERROR]		? BST_CHECKED	: BST_UNCHECKED);

			CheckDlgButton(hwndDlg, IDC_SCREENSAVER_LOCK,		m_abBoolSettings[SCREENSAVER_LOCK]		? BST_CHECKED	: BST_UNCHECKED);
			CheckDlgButton(hwndDlg, IDC_TRANSITIONS,		m_abBoolSettings[TRANSITIONS]		? BST_CHECKED	: BST_UNCHECKED);
			CheckDlgButton(hwndDlg, IDC_CONTROL_BACKLIGHTS,		m_abBoolSettings[CONTROL_BACKLIGHTS]		? BST_CHECKED	: BST_UNCHECKED);
			CheckDlgButton(hwndDlg, IDC_SHOW_LABELS,			m_abBoolSettings[SHOW_LABELS]		? BST_CHECKED	: BST_UNCHECKED);
			CheckDlgButton(hwndDlg, IDC_HOOK_VOLUMEWHEEL,		m_abBoolSettings[HOOK_VOLUMEWHEEL]		? BST_CHECKED	: BST_UNCHECKED);
			CheckDlgButton(hwndDlg, IDC_TIMESTAMP_SECONDS,		m_abBoolSettings[TIMESTAMP_SECONDS]		? BST_CHECKED	: BST_UNCHECKED);
			
			for(int i=0;i<FONT_SETTINGS;i++)
			{
				m_templogfont[i] = m_logfont[i];
				SendDlgItemMessage(hwndDlg,CConfig::GetSampleField(i),WM_SETFONT,(WPARAM)m_hSampleFont[i],(LPARAM)true);
			}
			
			// fill device box
			CConfig::hDeviceBox = GetDlgItem(hwndDlg,IDC_DEVICE);
			FillDeviceBox(CConfig::hDeviceBox);
			
			m_bInitializingDialog = false;
			break;
		}
		case WM_NOTIFY:
		{
			switch (((LPNMHDR)lParam)->code)
			{
				case PSN_APPLY:
				{
					m_abBoolSettings[SKIP_DRIVER_ERROR] =  IsDlgButtonChecked(hwndDlg,IDC_SKIP_DRIVER_ERROR) == BST_CHECKED ? true : false;

					m_abBoolSettings[SCREENSAVER_LOCK] =  IsDlgButtonChecked(hwndDlg,IDC_SCREENSAVER_LOCK) == BST_CHECKED ? true : false;
					m_abBoolSettings[TRANSITIONS] =  IsDlgButtonChecked(hwndDlg,IDC_TRANSITIONS) == BST_CHECKED ? true : false;
					m_abBoolSettings[SHOW_LABELS] =  IsDlgButtonChecked(hwndDlg,IDC_SHOW_LABELS) == BST_CHECKED ? true : false;
					m_abBoolSettings[CONTROL_BACKLIGHTS] =  IsDlgButtonChecked(hwndDlg,IDC_CONTROL_BACKLIGHTS) == BST_CHECKED ? true : false;
					m_abBoolSettings[HOOK_VOLUMEWHEEL] =  IsDlgButtonChecked(hwndDlg,IDC_HOOK_VOLUMEWHEEL) == BST_CHECKED ? true : false;
					m_abBoolSettings[TIMESTAMP_SECONDS] =  IsDlgButtonChecked(hwndDlg,IDC_TIMESTAMP_SECONDS) == BST_CHECKED ? true : false;
					m_aiIntSettings[DEVICE] = SendDlgItemMessage(hwndDlg,IDC_DEVICE,CB_GETCURSEL ,0,0);

					for(int i=0;i<FONT_SETTINGS;i++)
						m_logfont[i] = m_templogfont[i];

					CConfig::SaveSettings();
					SendMessage(hwndDlg, WM_INITDIALOG, 0, 0);
					break;
				}
			}
			break;
		}
		case WM_COMMAND:
		{
			if(LOWORD(wParam) == IDC_CREDITS)
			{
				CAppletManager::GetInstance()->ActivateCreditsScreen();
				break;
			}

			int iFont = LOWORD(wParam);
			switch(iFont)
			{
			case IDC_CHOOSEFONT1: iFont = 0; break;
			case IDC_CHOOSEFONT2: iFont = 1; break;
			case IDC_CHOOSEFONT3: iFont = 2; break;
			case IDC_CHOOSEFONT4: iFont = 3; break;
			case IDC_CHOOSEFONT5: iFont = 4; break;
			default: iFont = -1;
			};

			if(iFont >= 0)
			{
				CHOOSEFONT cf = { 0 };
				cf.lStructSize = sizeof(cf);
				cf.hwndOwner = hwndDlg;
				cf.lpLogFont = &m_templogfont[iFont];
				cf.Flags = CF_FORCEFONTEXIST | CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS;
				if (ChooseFont(&cf))
				{
					if(m_hSampleFont[iFont])
						DeleteObject(m_hSampleFont[iFont]);
					m_hSampleFont[iFont] =  CreateFontIndirect(&m_templogfont[iFont]);
					SendDlgItemMessage(hwndDlg,CConfig::GetSampleField(iFont),WM_SETFONT,(WPARAM)m_hSampleFont[iFont],(LPARAM)true);
					TRACE(_T("Font selected!"));
				}
			}
			if(LOWORD(wParam) == IDC_DEVICE && SendDlgItemMessage(hwndDlg,IDC_DEVICE,CB_GETCURSEL ,0,0) != m_aiIntSettings[DEVICE]) {
				SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
			}

			// Activate the apply button
			if (!m_bInitializingDialog && ((HIWORD(wParam) == EN_CHANGE) || (HIWORD(wParam) == BN_CLICKED))) {
//.........这里部分代码省略.........
开发者ID:0xmono,项目名称:miranda-ng,代码行数:101,代码来源:CConfig.cpp


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