本文整理汇总了C++中SetWindowFont函数的典型用法代码示例。如果您正苦于以下问题:C++ SetWindowFont函数的具体用法?C++ SetWindowFont怎么用?C++ SetWindowFont使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetWindowFont函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AboutDialogProc
INT_PTR CALLBACK AboutDialogProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
{
switch (Msg)
{
case WM_INITDIALOG:
{
char tmp[256];
CenterWindow(hDlg);
hBrush = CreateSolidBrush(RGB(235, 233, 237));
HBITMAP hBmp = (HBITMAP)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_SPLASH), IMAGE_BITMAP, 0, 0, LR_SHARED);
SendMessage(GetDlgItem(hDlg, IDC_ABOUT), STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hBmp);
hFont = CreateFont(-11, 0, 0, 0, 400, 0, 0, 0, 0, 3, 2, 1, 34, TEXT("Verdana"));
hFontFX = CreateFont(-12, 0, 0, 0, 400, 0, 0, 0, 0, 3, 2, 1, 34, TEXT("Verdana"));
SetWindowFont(GetDlgItem(hDlg, IDC_TEXT1), hFont, true);
SetWindowFont(GetDlgItem(hDlg, IDC_TEXT2), hFont, true);
SetWindowFont(GetDlgItem(hDlg, IDC_TEXT3), hFont, true);
SetWindowFont(GetDlgItem(hDlg, IDC_TEXT4), hFont, true);
SetWindowFont(GetDlgItem(hDlg, IDC_SICKFX), hFontFX, true);
win_set_window_text_utf8(GetDlgItem(hDlg, IDC_BUILD), "Build time: " __DATE__" - " __TIME__"");
snprintf(tmp, WINUI_ARRAY_LENGTH(tmp), "Version: %s", MAME_VERSION);
win_set_window_text_utf8(GetDlgItem(hDlg, IDC_BUILDVER), tmp);
return true;
}
case WM_CTLCOLORDLG:
return (LRESULT) hBrush;
case WM_CTLCOLORSTATIC:
case WM_CTLCOLORBTN:
hDC = (HDC)wParam;
SetBkMode(hDC, TRANSPARENT);
SetTextColor(hDC, GetSysColor(COLOR_WINDOWTEXT));
if ((HWND)lParam == GetDlgItem(hDlg, IDC_SICKFX))
SetTextColor(hDC, RGB(63, 72, 204));
return (LRESULT) hBrush;
case WM_COMMAND:
switch (GET_WM_COMMAND_ID(wParam, lParam))
{
case IDOK:
case IDCANCEL:
DeleteObject(hFont);
DeleteObject(hFontFX);
DeleteObject(hBrush);
EndDialog(hDlg, 0);
return true;
}
break;
}
return false;
}
示例2: SetWindowFont
void CInformationPanel::RealizeStyle()
{
if (m_hwnd!=NULL) {
if (m_fUseRichEdit) {
SetWindowFont(m_hwndProgramInfo,m_Font.GetHandle(),FALSE);
UpdateProgramInfoText();
} else {
SetWindowFont(m_hwndProgramInfo,m_Font.GetHandle(),TRUE);
}
SendSizeMessage();
Invalidate();
m_Tooltip.SetFont(m_Font.GetHandle());
}
}
示例3: genopt_window_create_osd_frame
static void genopt_window_create_osd_frame(HWND container, LPCTSTR title, const int index,
const int x, const int y, const int w, const int h)
{
// Message frame
HWND grpBox, lblColor;
grpBox = CreateWindow(WC_BUTTON, title,
WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_GROUPBOX,
x, y, w, h,
container, NULL, ghInstance, NULL);
SetWindowFont(grpBox, fntMain, true);
// Enable
chkOSD_Enable[index] = CreateWindow(WC_BUTTON, TEXT("Enable"),
WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX,
x+8, y+16, 128, 20,
container, NULL, ghInstance, NULL);
SetWindowFont(chkOSD_Enable[index], fntMain, true);
// Double Sized
chkOSD_DoubleSized[index] = CreateWindow(WC_BUTTON, TEXT("Double Sized"),
WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX,
x+8, y+16+20, 128, 20,
container, NULL, ghInstance, NULL);
SetWindowFont(chkOSD_DoubleSized[index], fntMain, true);
// Transparency
chkOSD_Transparency[index] = CreateWindow(WC_BUTTON, TEXT("Transparency"),
WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX,
x+8, y+16+20+20, 128, 20,
container, NULL, ghInstance, NULL);
SetWindowFont(chkOSD_Transparency[index], fntMain, true);
// Color label
lblColor = CreateWindow(WC_STATIC, TEXT("Color:"),
WS_CHILD | WS_VISIBLE | SS_LEFT,
x+8, y+16+20+20+20+2, 36, 20,
container, NULL, ghInstance, NULL);
SetWindowFont(lblColor, fntMain, true);
// Radio buttons
for (int i = 0; i < 4; i++)
{
optOSD_Color[index][i] = CreateWindow(
WC_STATIC, NULL, WS_CHILD | WS_VISIBLE | SS_CENTER | SS_OWNERDRAW | SS_NOTIFY,
x+8+36+4+(i*(16+8)), y+16+20+20+20+2, 16, 16,
container, (HMENU)(0xA000 + ((index * 4) + i)), ghInstance, NULL);
}
}
示例4: SetExtendedUI
void
TFlatComboBox::SetupWindow()
{
TComboBox::SetupWindow();
SetExtendedUI(true);
SetWindowFont((HFONT)GetStockObject(ANSI_VAR_FONT), true);
}
示例5: CalPos
void CDateTimeWnd::Init(CDateTimeUI* pOwner)
{
m_pOwner = pOwner;
m_pOwner->m_nDTUpdateFlag = DT_NONE;
if (m_hWnd == NULL)
{
RECT rcPos = CalPos();
UINT uStyle =WS_CHILD|m_pOwner->m_dwStyle;// 修改者:YYM
Create(m_pOwner->GetManager()->GetPaintWindow(), NULL, uStyle, 0, rcPos);
SetWindowFont(m_hWnd, m_pOwner->GetManager()->GetFontInfo(m_pOwner->GetFont())->hFont, TRUE);
//lxm,added,修改Date控件日期为横线
if(m_pOwner->m_dwStyle == DTS_SHORTDATECENTURYFORMAT || m_pOwner->m_dwStyle == DTS_SHORTDATEFORMAT)
{
CDuiString strFormat = _T("yyyy-MM-dd");
::SendMessage(m_hWnd, DTM_SETFORMAT, 0, (LPARAM)strFormat.GetData());
}
}
if (m_pOwner->GetText().IsEmpty())
::GetLocalTime(&m_pOwner->m_sysTime);
::SendMessage(m_hWnd, DTM_SETSYSTEMTIME, 0, (LPARAM)&m_pOwner->m_sysTime);
::ShowWindow(m_hWnd, SW_SHOWNOACTIVATE);
::SetFocus(m_hWnd);
//
// SYSTEMTIME sysTimes[2];
// GetLocalTime(&(sysTimes[0]));
// DateTime_SetRange(m_hWnd,GDTR_MIN,sysTimes );
m_bInit = true;
}
示例6: Cls_OnInitDialog
static BOOL Cls_OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam)
{
HWND hwndChild;
TCHAR szFormat[64],
szBuffer[64];
#ifndef WIN32
hwndChild = GetFirstChild(hwnd);
while (hwndChild)
{
SetWindowFont(hwndChild, hFontDialog, FALSE);
hwndChild = GetNextSibling(hwndChild);
}
#endif
LoadString(hInstance, IDS_MIO_TITLE, szFormat, SIZEOF_IN_CHAR(szFormat));
wsprintf(szBuffer, szFormat, wMIOSlotNumber);
SetWindowText(hwnd, szBuffer);
if (hwndChild = GetDlgItem(hwnd, IDC_MIO_TYPE))
{
SetWindowWord(hwndChild, GWW_TRAYLEVEL, 1000);
SetWindowText(hwndChild, mio_card[wMIOSlotNumber - 1].mioType);
}
if (hwndChild = GetDlgItem(hwnd, IDC_MIO_DESCRIPTION))
{
SetWindowWord(hwndChild, GWW_TRAYLEVEL, 1000);
SetWindowText(hwndChild, mio_card[wMIOSlotNumber - 1].mioInfo);
}
return TRUE;
}
示例7: assert
int
CheckBox::make_dialog_gadgets( HWND hPanel )
{
assert( _td );
assert( hPanel );
assert( hInstance );
assert( _td->name );
int wLabel = uiDialog::make_dialog_gadgets( hPanel );
hwndCheckbox = theAttributes.CreateWindowEx(
0,
"BUTTON",
_td->xdata.displayName,
0 | WS_TABSTOP | BS_AUTOCHECKBOX,
5 + wLabel,
theAttributes.y,
16, // width
16, // height
hPanel );
assert( hwndCheckbox );
SetWindowFont( hwndCheckbox, (HFONT)theAttributes.ip->GetIObjParam()->GetAppHFont(), TRUE );
reset();
return 5 + wLabel + 16;
}
示例8: CalPos
void CIPAddressWnd::Init(CIPAddressUI* pOwner)
{
m_pOwner = pOwner;
m_pOwner->m_nIPUpdateFlag = IP_NONE;
if (m_hWnd == NULL)
{
INITCOMMONCONTROLSEX CommCtrl;
CommCtrl.dwSize=sizeof(CommCtrl);
CommCtrl.dwICC=ICC_INTERNET_CLASSES;//指定Class
if(InitCommonControlsEx(&CommCtrl))
{
RECT rcPos = CalPos();
UINT uStyle = WS_CHILD | WS_TABSTOP | WS_GROUP;
Create(m_pOwner->GetManager()->GetPaintWindow(), NULL, uStyle, 0, rcPos);
}
SetWindowFont(m_hWnd, m_pOwner->GetManager()->GetFontInfo(m_pOwner->GetFont())->hFont, TRUE);
}
if (m_pOwner->GetText().IsEmpty())
m_pOwner->m_dwIP = GetLocalIpAddress();
::SendMessage(m_hWnd, IPM_SETADDRESS, 0, m_pOwner->m_dwIP);
::ShowWindow(m_hWnd, SW_SHOW);
::SetFocus(m_hWnd);
m_bInit = true;
}
示例9: CalPos
void CPathEditWnd::Init( CPathEditUI* pOwner )
{
m_pOwner = pOwner;
RECT rcPos = CalPos();
UINT uStyle = WS_CHILD | ES_AUTOHSCROLL;
if( m_pOwner->IsPasswordMode() ) uStyle |= ES_PASSWORD;
Create(m_pOwner->GetManager()->GetPaintWindow(), NULL, uStyle, 0, rcPos);
HFONT hFont=NULL;
int iFontIndex=m_pOwner->GetFont();
if (iFontIndex!=-1)
hFont=m_pOwner->GetManager()->GetFont(iFontIndex);
if (hFont==NULL)
hFont=m_pOwner->GetManager()->GetDefaultFontInfo()->hFont;
SetWindowFont(m_hWnd, hFont, TRUE);
Edit_LimitText(m_hWnd, m_pOwner->GetMaxChar());
if( m_pOwner->IsPasswordMode() ) Edit_SetPasswordChar(m_hWnd, m_pOwner->GetPasswordChar());
Edit_SetText(m_hWnd, m_pOwner->GetText());
Edit_SetModify(m_hWnd, FALSE);
SendMessage(EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELPARAM(0, 0));
Edit_Enable(m_hWnd, m_pOwner->IsEnabled() == true);
Edit_SetReadOnly(m_hWnd, m_pOwner->IsReadOnly() == true);
//Styls
LONG styleValue = ::GetWindowLong(m_hWnd, GWL_STYLE);
styleValue |= pOwner->GetWindowStyls();
::SetWindowLong(GetHWND(), GWL_STYLE, styleValue);
::ShowWindow(m_hWnd, SW_SHOWNOACTIVATE);
::SetFocus(m_hWnd);
m_bInit = true;
}
示例10: ShowCurItemHint
static void ShowCurItemHint (HWND hWnd, PCOOL_INDICATOR_CTRL cb)
{
COOL_INDICATOR_ITEMDATA* tmpdata;
PCOOL_INDICATOR_CTRL TbarData = (PCOOL_INDICATOR_CTRL) GetWindowAdditionalData2(hWnd);
int x, y;
tmpdata = GetCurSel(cb);
if(tmpdata == NULL)
return;
x = tmpdata->hintx;
y = tmpdata->hinty;
if (tmpdata->Hint [0] == '\0')
return;
ClientToScreen (hWnd, &x, &y);
if (g_rcScr.bottom - y < y - g_rcScr.top) {
y -= (GetSysCharHeight () + (2 << 1) + cb->ItemHeight);
}
if (TbarData->hToolTip == 0) {
TbarData->hToolTip = CreateCdrToolTipWin (hWnd, x, y, 1000, tmpdata->Hint);
SetWindowFont(TbarData->hToolTip, GetWindowFont(hWnd));
}
else {
ResetCdrToolTipWin (TbarData->hToolTip, x, y, tmpdata->Hint);
}
}
示例11: CalPos
void CEditWnd::Init(CEditUI* pOwner)
{
m_pOwner = pOwner;
RECT rcPos = CalPos();
UINT uStyle = WS_CHILD | ES_AUTOHSCROLL;
if (m_pOwner->IsPasswordMode()) uStyle |= ES_PASSWORD;
Create(m_pOwner->GetManager()->GetPaintWindow(), NULL, uStyle, 0, rcPos);
SetWindowFont(m_hWnd, m_pOwner->GetManager()->GetFontInfo(m_pOwner->GetFont())->hFont, TRUE);
Edit_LimitText(m_hWnd, m_pOwner->GetMaxChar());
if (m_pOwner->IsPasswordMode()) Edit_SetPasswordChar(m_hWnd, m_pOwner->GetPasswordChar());
Edit_SetText(m_hWnd, m_pOwner->GetText());
Edit_SetModify(m_hWnd, FALSE);
SendMessage(EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELPARAM(0, 0));
Edit_Enable(m_hWnd, m_pOwner->IsEnabled() == true);
Edit_SetReadOnly(m_hWnd, m_pOwner->IsReadOnly() == true);
::ShowWindow(m_hWnd, SW_SHOWNOACTIVATE);
::SetFocus(m_hWnd);
m_bInit = true;
}
示例12: ListViewWndProc
static LRESULT CALLBACK ListViewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
struct PickerInfo *pPickerInfo;
LRESULT rc = 0;
BOOL bHandled = FALSE;
WNDPROC pfnParentWndProc;
HWND hwndHeaderCtrl = NULL;
HFONT hHeaderCtrlFont = NULL;
pPickerInfo = GetPickerInfo(hWnd);
pfnParentWndProc = pPickerInfo->pfnParentWndProc;
switch(message)
{
case WM_MOUSEMOVE:
if (MouseHasBeenMoved())
ShowCursor(TRUE);
break;
case WM_ERASEBKGND:
if (GetBackgroundBitmap())
{
rc = ListViewOnErase(hWnd, (HDC) wParam);
bHandled = TRUE;
}
break;
case WM_NOTIFY:
bHandled = ListViewNotify(hWnd, (LPNMHDR) lParam);
break;
case WM_SETFONT:
hwndHeaderCtrl = ListView_GetHeader(hWnd);
if (hwndHeaderCtrl)
hHeaderCtrlFont = GetWindowFont(hwndHeaderCtrl);
break;
case WM_CONTEXTMENU:
bHandled = ListViewContextMenu(hWnd, lParam);
break;
case WM_DESTROY:
// Received WM_DESTROY; time to clean up
if (pPickerInfo->pCallbacks->pfnSetViewMode)
pPickerInfo->pCallbacks->pfnSetViewMode(pPickerInfo->nCurrentViewID);
Picker_Free(pPickerInfo);
SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR) pfnParentWndProc);
SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR) NULL);
break;
}
if (!bHandled)
rc = CallParentWndProc(pfnParentWndProc, hWnd, message, wParam, lParam);
// If we received WM_SETFONT, reset header ctrl font back to original font
if (hwndHeaderCtrl)
SetWindowFont(hwndHeaderCtrl, hHeaderCtrlFont, TRUE);
return rc;
}
示例13: AfxGetApp
BOOL CMsgReplayWnd::bCreateReplayWindow()
{
INT nReturn = 0;
// If the co-ordiantes are not correct, calculate the default value
CRect omRect;
if (m_sWndPlacement.length == 0)
{
AfxGetApp()->GetMainWnd()->GetWindowPlacement(&m_sWndPlacement);
}
CString omStrTitle = _(defSTR_REPLAY_WINDOW_TITLE) +
m_ouReplayDetails.m_ouReplayFile.m_omStrFileName;
nReturn = Create( nullptr,
omStrTitle,
WS_CHILD |
WS_VISIBLE | WS_OVERLAPPEDWINDOW,
m_sWndPlacement.rcNormalPosition,
nullptr,
nullptr );
SetWindowFont();
SendMessage(WM_NCPAINT, 1, 0);
// Update Window Pointer in the Replay information object
m_ouReplayDetails.m_pReplayWndPtr = this;
// Update window with paint
UpdateWindow();
return nReturn;
}
示例14: SetWindowFont
void IRA_Dialog::SetFont(HWND hwndCtl, HFONT hfont, BOOL fRedraw)
{
// This messed up the colors and did some whacky recursion without the if
// Damn it dude
if(fRedraw)
SetWindowFont(hwndCtl, hfont, fRedraw);
}
示例15: CalcFontHeight
bool CInformationPanel::SetFont(const LOGFONT *pFont)
{
if (!m_Font.Create(pFont))
return false;
if (m_hwnd!=NULL) {
CalcFontHeight();
if (m_fUseRichEdit) {
SetWindowFont(m_hwndProgramInfo,m_Font.GetHandle(),FALSE);
UpdateProgramInfoText();
} else {
SetWindowFont(m_hwndProgramInfo,m_Font.GetHandle(),TRUE);
}
SendSizeMessage();
Invalidate();
}
return true;
}