本文整理汇总了C++中GetDialogBaseUnits函数的典型用法代码示例。如果您正苦于以下问题:C++ GetDialogBaseUnits函数的具体用法?C++ GetDialogBaseUnits怎么用?C++ GetDialogBaseUnits使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetDialogBaseUnits函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: WindowProcedure
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
static HWND hwndList,hwndboton,hwndlabel1,hwndlabel2,hwndtext,hwndboton2;
int iIndex, iLength, cxChar, cyChar;
char nombre[260];
char numero[30];
switch (message)
{
case WM_CTLCOLORSTATIC:
{
HDC hdcStatic = (HDC) wParam;
SetBkColor(hdcStatic,RGB(211,208,201));
return (INT_PTR)CreateSolidBrush(RGB(211,208,201));
}
case WM_CREATE:
{
cxChar = LOWORD(GetDialogBaseUnits());
cyChar = HIWORD(GetDialogBaseUnits());
hwndlabel1 = CreateWindowEx(0,"static", "Selecciona el proceso a Dumpear:", WS_CHILD|WS_VISIBLE|WS_TABSTOP, 10, 10, 230, 20, hwnd, 0, (HINSTANCE)GetWindowLong(hwnd, GWL_HINSTANCE), NULL);
hwndlabel2 = CreateWindowEx(0,"static", "Número de offsets a dumpear:", WS_CHILD|WS_VISIBLE|WS_TABSTOP, 10, 60, 230, 20, hwnd, 0, (HINSTANCE)GetWindowLong(hwnd, GWL_HINSTANCE), NULL);
hwndList = CreateWindow(TEXT("Combobox"), NULL, WS_CHILD | WS_VISIBLE |LBS_STANDARD, 10, 30, 200,60, hwnd, (HMENU)ID_LIST, (HINSTANCE)GetWindowLong(hwnd, GWL_HINSTANCE),NULL);
hwndboton = CreateWindowEx(0,"BUTTON", "Refrescar", WS_CHILD|WS_VISIBLE|WS_TABSTOP, 215, 30, 70, 20, hwnd, 0, (HINSTANCE)GetWindowLong(hwnd, GWL_HINSTANCE), NULL);
hwndtext = CreateWindowEx(0,"Edit", "", WS_CHILD|WS_VISIBLE|WS_BORDER, 215, 60, 70, 20, hwnd, 0, (HINSTANCE)GetWindowLong(hwnd, GWL_HINSTANCE), NULL);
hwndboton2 = CreateWindowEx(0,"BUTTON", "Dumpear!", WS_CHILD|WS_VISIBLE|WS_TABSTOP, 10, 85, 275, 20, hwnd, 0, (HINSTANCE)GetWindowLong(hwnd, GWL_HINSTANCE), NULL);
Opciones(hwndList);
return 0;
}
case WM_COMMAND:
{
if((HWND)lParam==hwndboton)
{
Opciones(hwndList);
MessageBoxA(miid,"Se a refrescado la lista de procesos","Drink Dump v1.0",MB_OK);
}
if((HWND)lParam==hwndboton2)
{
GetWindowText(hwndtext,numero,10);
GetWindowText(hwndList,nombre,260);
Dumpear(nombre,numero);
}
break;
}
case WM_DESTROY:
{
PostQuitMessage (0);
break;
}
default:
return DefWindowProc (hwnd, message, wParam, lParam);
}
return 0;
}
开发者ID:0aps,项目名称:Legacy-Code,代码行数:59,代码来源:dumper.cpp
示例2: kwin_getminmaxinfo
/*
* Function: Process WM_GETMINMAXINFO messages
*/
static void
kwin_getminmaxinfo(HWND hwnd, LPMINMAXINFO lpmmi)
{
lpmmi->ptMinTrackSize.x =
(KWIN_MIN_WIDTH * LOWORD(GetDialogBaseUnits())) / 4;
lpmmi->ptMinTrackSize.y =
(KWIN_MIN_HEIGHT * HIWORD(GetDialogBaseUnits())) / 8;
}
开发者ID:Akasurde,项目名称:krb5,代码行数:12,代码来源:cns.c
示例3: StretchBitmap
HBITMAP StretchBitmap (HBITMAP hBitmap1)
{
BITMAP bm1, bm2 ;
HBITMAP hBitmap2 ;
HDC hdc, hdcMem1, hdcMem2 ;
int cxChar, cyChar ;
// Get the width and height of a system font character
cxChar = LOWORD (GetDialogBaseUnits ()) ;
cyChar = HIWORD (GetDialogBaseUnits ()) ;
// Create 2 memory DCs compatible with the display
hdc = CreateIC (TEXT ("DISPLAY"), NULL, NULL, NULL) ;
hdcMem1 = CreateCompatibleDC (hdc) ;
hdcMem2 = CreateCompatibleDC (hdc) ;
DeleteDC (hdc) ;
// Get the dimensions of the bitmap to be stretched
GetObject (hBitmap1, sizeof (BITMAP), (PTSTR) &bm1) ;
// Scale these dimensions based on the system font size
bm2 = bm1 ;
bm2.bmWidth = (cxChar * bm2.bmWidth) / 4 ;
bm2.bmHeight = (cyChar * bm2.bmHeight) / 8 ;
bm2.bmWidthBytes = ((bm2.bmWidth + 15) / 16) * 2 ;
// Create a new bitmap of larger size
hBitmap2 = CreateBitmapIndirect (&bm2) ;
// Select the bitmaps in the memory DCs and do a StretchBlt
SelectObject (hdcMem1, hBitmap1) ;
SelectObject (hdcMem2, hBitmap2) ;
StretchBlt (hdcMem2, 0, 0, bm2.bmWidth, bm2.bmHeight,
hdcMem1, 0, 0, bm1.bmWidth, bm1.bmHeight, SRCCOPY) ;
// Clean up
DeleteDC (hdcMem1) ;
DeleteDC (hdcMem2) ;
DeleteObject (hBitmap1) ;
return hBitmap2 ;
}
开发者ID:Jeanhwea,项目名称:petzold-pw5e,代码行数:50,代码来源:GrafMenu.c
示例4: create_item
static int create_item(HDC hdc, const SANE_Option_Descriptor *opt,
INT id, LPDLGITEMTEMPLATEW *template_out, int y, int *cx, int* count)
{
LPDLGITEMTEMPLATEW tpl = NULL,rc = NULL;
WORD class = 0xffff;
DWORD styles = WS_VISIBLE;
LPBYTE ptr = NULL;
LPDLGITEMTEMPLATEW lead_static = NULL;
LPDLGITEMTEMPLATEW trail_edit = NULL;
DWORD leading_len = 0;
DWORD trail_len = 0;
DWORD local_len = 0;
LPCSTR title = NULL;
CHAR buffer[255];
int padding = 0;
int padding2 = 0;
int base_x = 0;
LONG base;
int ctl_cx = 0;
SIZE size;
GetTextExtentPoint32A(hdc,"X",1,&size);
base = GetDialogBaseUnits();
base_x = MulDiv(size.cx,4,LOWORD(base));
if (opt->type == SANE_TYPE_BOOL)
{
class = 0x0080; /* Button */
styles |= BS_AUTOCHECKBOX;
local_len += MultiByteToWideChar(CP_ACP,0,opt->title,-1,NULL,0);
local_len *= sizeof(WCHAR);
title = opt->title;
}
else if (opt->type == SANE_TYPE_INT)
开发者ID:DeltaYang,项目名称:wine,代码行数:34,代码来源:ui.c
示例5: GetClientRect
void CPrefView::ReSize()
{
CRect rect;
CRect rect_cy;
GetClientRect(rect);
int x=rect.right;
int y=rect.bottom;
// if (x<500) x=500;
// if (y<400) y=400;
LONG l=GetDialogBaseUnits();
double kx=LOWORD(l)/8.0;
double ky=HIWORD(l)/16.0;
m_ComboY.GetClientRect(rect_cy);
WORD dx=6;
WORD dy=13;
int x1,y1;
x1=(136*dx)/4; y1=(125*dy)/8;
//m_Grid.MoveWindow((int)(x1*kx),(int)(y1*ky),(int)(x-x1*kx-10),(int)(y-y1*ky-10));
m_Grid.MoveWindow(rect_cy.right+30,(int)(y1*ky),(int)(x-rect_cy.right-40),(int)(y-y1*ky-10));
GetDlgItem(IDC_STATIC_FACE)->MoveWindow((int)(x-40*kx),(int)(33*ky),32,32);
x1=(140*dx)/4; y1=(13*dy)/8;
//GetDlgItem(IDC_STATIC_SCALE)->MoveWindow((int)(x1*kx),(int)(33*ky),(int)(x-(x1+50)*kx),(int)(20*ky));
GetDlgItem(IDC_STATIC_SCALE)->MoveWindow(rect_cy.right+30,(int)(33*ky),(int)(x-rect_cy.right-30-50*kx),(int)(20*ky));
//y1=(25*dy)/8;
//m_Slider.MoveWindow((int)(x1*kx),(int)(55*ky),(int)(x-(x1+50)*kx),(int)(30*ky));
m_Slider.MoveWindow(rect_cy.right+30,(int)(55*ky),(int)(x-rect_cy.right-30-50*kx),(int)(30*ky));
}
开发者ID:sudakov,项目名称:DSS-UTES,代码行数:28,代码来源:PrefView.cpp
示例6: hugsprim_GetDialogBaseUnits_10
static void hugsprim_GetDialogBaseUnits_10(HugsStackPtr hugs_root)
{
HsInt32 res1;
res1 = GetDialogBaseUnits();
hugs->putInt32(res1);
hugs->returnIO(hugs_root,1);
}
开发者ID:xpika,项目名称:winhugs,代码行数:7,代码来源:Dialogue.c
示例7: zGetDialogBaseUnits
DWORD far pascal zGetDialogBaseUnits()
{
DWORD r;
SaveRegs();
/*
** Log IN Parameters (No Create/Destroy Checking Yet!)
*/
LogIn( (LPSTR)"APICALL:GetDialogBaseUnits " );
/*
** Call the API!
*/
RestoreRegs();
GrovelDS();
r = GetDialogBaseUnits();
UnGrovelDS();
SaveRegs();
/*
** Log Return Code & OUT Parameters (No Create/Destroy Checking Yet!)
*/
LogOut( (LPSTR)"APIRET:GetDialogBaseUnits DWORD+", r );
RestoreRegs();
return( r );
}
开发者ID:mingpen,项目名称:OpenNT,代码行数:26,代码来源:tudlg.c
示例8: MapDialogRect
void WINAPI
MapDialogRect(HWND hDlg, RECT FAR *lpRect)
{
HDC hDC;
HFONT hFont, hFontOld = 0;
TEXTMETRIC TextMetrics;
DWORD dwFontUnits;
int width, height;
hDC = GetDC(hDlg);
hFont = (HFONT)SendMessage(hDlg, WM_GETFONT, 0, 0);
if ( hFont )
hFontOld = SelectObject(hDC, hFont);
if ( GetTextMetrics(hDC, &TextMetrics) ) {
width = TextMetrics.tmAveCharWidth;
height = TextMetrics.tmHeight;
} else {
dwFontUnits = GetDialogBaseUnits();
width = (int)LOWORD(dwFontUnits);
height = (int)HIWORD(dwFontUnits);
}
if ( hFontOld )
SelectObject(hDC, hFontOld);
ReleaseDC(hDlg,hDC);
lpRect->left = MulDiv(lpRect->left, width, 4);
lpRect->top = MulDiv(lpRect->top, height, 8);
lpRect->right = MulDiv(lpRect->right, width, 4);
lpRect->bottom = MulDiv(lpRect->bottom, height, 8);
}
开发者ID:ErisBlastar,项目名称:osfree,代码行数:32,代码来源:Dialog.c
示例9: GlobalInitialize
/*-----------------------------------------------------------------------------
FUNCTION: GlobalInitialize
PURPOSE: Intializes global variables before any windows are created
COMMENTS: Partner to GlobalCleanup
HISTORY: Date: Author: Comment:
10/27/95 AllenD Wrote it
-----------------------------------------------------------------------------*/
void GlobalInitialize()
{
#if USEWIN32
int cyMenuHeight, cyCaptionHeight, cyFrameHeight;
int k;
//
// font for status reporting control
//
ghFontStatus = CreateStatusEditFont();
ghFontVTTY = CreateVTTYFont();
//
// the following are used for sizing the tty window and dialog windows
//
gwBaseY = HIWORD(GetDialogBaseUnits());
cyMenuHeight = GetSystemMetrics(SM_CYMENU);
cyCaptionHeight = GetSystemMetrics(SM_CYCAPTION);
cyFrameHeight = GetSystemMetrics(SM_CYFRAME);
gcyMinimumWindowHeight = cyMenuHeight + \
4 * cyCaptionHeight + \
2 * cyFrameHeight +
(SETTINGSFACTOR + STATUSFACTOR) * gwBaseY ;
#endif
return ;
}
开发者ID:johnlpayton,项目名称:mxvsp-linux,代码行数:39,代码来源:init.c
示例10: GetNewBrowserFont
static HFONT GetNewBrowserFont(HDC hDC, LPSTR pTypeFace,
WORD wStyle, int size,
BYTE bItalic, BYTE bUnderline, BYTE bVector)
{
if (!FontFace[0])
{
WORD ylu = HIWORD(GetDialogBaseUnits());
KppGetKappaIniFile(return_buffer, RET_BUFFER_LEN);
GetPrivateProfileString("Browser", "FontFace", "Default",
FontFace, 32, return_buffer);
FontSize = GetPrivateProfileInt("Browser", "FontSize",
wStartFontSize, return_buffer);
/* Get FontSize in points */
FontSize = (FontSize * ylu * 72) / (8 * wLogPixelY);
bDefaultFont = !strcmpi(FontFace, "Default");
}
if (bDefaultFont)
strcpy(FontFace, pTypeFace);
else if (size == (int) wStartFontSize)
size = FontSize;
if (wStartFontSize != START_FONT_SIZE)
size = MulDiv(size, wStartFontSize, START_FONT_SIZE);
return GetNewFont(FontFace, wStyle, size, bItalic, bUnderline, bVector);
}
开发者ID:thearttrooper,项目名称:KappaPC,代码行数:28,代码来源:BROWSER.C
示例11: LOWORD
INT_PTR CALLBACK OptionsPageMore::aboutBoxDialogProc(
HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if (uMsg == WM_INITDIALOG)
{
int iconSize = LOWORD(GetDialogBaseUnits()) * 24 / 4;
auto appIcon = LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_A),
IMAGE_ICON, iconSize, iconSize, LR_DEFAULTCOLOR);
Static_SetIcon(GetDlgItem(hwnd, IDC_ABOUT_ICON), appIcon);
SetDlgItemText(hwnd, IDC_ABOUT_VERSION, L"Version: " APP_VERSION);
SetDlgItemText(hwnd, IDC_ABOUT_DATE, L"Compiled on: " APP_DATE);
return TRUE;
}
if (uMsg == WM_NOTIFY)
{
auto pHdr = (const PNMLINK) lParam;
if (pHdr->hdr.code == NM_CLICK || pHdr->hdr.code == NM_RETURN)
{
ShellExecute(NULL, L"open", pHdr->item.szUrl, NULL, NULL, SW_SHOW);
return TRUE;
}
else {
return FALSE;
}
}
else if (uMsg == WM_COMMAND && HIWORD(wParam) == BN_CLICKED)
{
DestroyIcon(Static_GetIcon(GetDlgItem(hwnd, IDC_ABOUT_ICON), 0));
EndDialog(hwnd, IDOK);
return TRUE;
}
else {
return FALSE;
}
}
开发者ID:troiganto,项目名称:autosave,代码行数:35,代码来源:OptionsPageMore.cpp
示例12: get_dialog_font_metrics
static void
get_dialog_font_metrics(void)
{
DWORD dlgFontSize;
dlgFontSize = GetDialogBaseUnits(); /* fall back to big old system*/
s_dlgfntwidth = LOWORD(dlgFontSize);
s_dlgfntheight = HIWORD(dlgFontSize);
}
开发者ID:Stolas,项目名称:vim-qt,代码行数:8,代码来源:gui_w16.c
示例13: CC_PaintCross
/***********************************************************************
* CC_PaintCross [internal]
*/
static void CC_PaintCross( HWND hDlg, int x, int y)
{
HDC hDC;
int w = GetDialogBaseUnits() - 1;
int wc = GetDialogBaseUnits() * 3 / 4;
HWND hwnd = GetDlgItem(hDlg, 0x2c6);
LPCCPRIV lpp = GetPropW( hDlg, szColourDialogProp );
RECT rect;
POINT point, p;
HPEN hPen;
if (IsWindowVisible( GetDlgItem(hDlg, 0x2c6) )) /* if full size */
{
GetClientRect(hwnd, &rect);
hDC = GetDC(hwnd);
SelectClipRgn( hDC, CreateRectRgnIndirect(&rect));
point.x = ((long)rect.right * (long)x) / (long)MAXHORI;
point.y = rect.bottom - ((long)rect.bottom * (long)y) / (long)MAXVERT;
if ( lpp->oldcross.left != lpp->oldcross.right )
BitBlt(hDC, lpp->oldcross.left, lpp->oldcross.top,
lpp->oldcross.right - lpp->oldcross.left,
lpp->oldcross.bottom - lpp->oldcross.top,
lpp->hdcMem, lpp->oldcross.left, lpp->oldcross.top, SRCCOPY);
lpp->oldcross.left = point.x - w - 1;
lpp->oldcross.right = point.x + w + 1;
lpp->oldcross.top = point.y - w - 1;
lpp->oldcross.bottom = point.y + w + 1;
hPen = CreatePen(PS_SOLID, 3, 0x000000); /* -black- color */
hPen = SelectObject(hDC, hPen);
MoveToEx(hDC, point.x - w, point.y, &p);
LineTo(hDC, point.x - wc, point.y);
MoveToEx(hDC, point.x + wc, point.y, &p);
LineTo(hDC, point.x + w, point.y);
MoveToEx(hDC, point.x, point.y - w, &p);
LineTo(hDC, point.x, point.y - wc);
MoveToEx(hDC, point.x, point.y + wc, &p);
LineTo(hDC, point.x, point.y + w);
DeleteObject( SelectObject(hDC, hPen));
ReleaseDC(hwnd, hDC);
}
}
开发者ID:RareHare,项目名称:reactos,代码行数:47,代码来源:colordlg.c
示例14: dc
void
CAboutDialog::OnPaint(HDC hDC)
{
//
// HDC hDC is not a DC
// bug in atlcrack.h
//
CPaintDC dc(m_hWnd);
SIZE sizePic = {0, 0};
m_pix.GetSizeInPixels(sizePic);
CRect rcWnd, rcClient;
GetClientRect(rcClient);
GetWindowRect(rcWnd);
ATLTRACE(_T("Picture Size: %d, %d\n"), sizePic.cx, sizePic.cy);
ATLTRACE(_T("Client Size: %d, %d\n"), rcClient.Width(), rcClient.Height());
ATLTRACE(_T("Window Size: %d, %d\n"), rcWnd.Width(), rcWnd.Height());
//
// adjust the picture size to the same width of the dialog
//
SIZE sizeAdj =
{
rcWnd.Width(),
MulDiv(sizePic.cy, rcWnd.Width(), sizePic.cx)
};
LONG lBaseUnits = GetDialogBaseUnits();
INT baseX = LOWORD(lBaseUnits);
INT baseY = HIWORD(lBaseUnits);
INT tplX = MulDiv(sizePic.cx, 4, baseX);
INT tplY = MulDiv(sizePic.cy, 4, baseY);
ATLTRACE(_T("Adjusted Size: %d, %d\n"), sizeAdj.cx, sizeAdj.cy);
//
// avoid distortion from a little difference
//
int diff = sizePic.cx - sizeAdj.cx;
diff = (diff > 0) ? diff : -diff;
if (diff < 30)
{
sizeAdj = sizePic;
}
ATLTRACE(_T("Using Size: %d, %d\n"), sizeAdj.cx, sizeAdj.cy);
CRect rectPic(CPoint(0,0),sizeAdj);
CDCHandle dcHandle;
dcHandle.Attach((HDC)dc);
m_pix.Render(dcHandle, rectPic);
}
开发者ID:yzx65,项目名称:ndas4windows,代码行数:56,代码来源:eventhandler.cpp
示例15: Main_WindowProc
LRESULT CALLBACK Main_WindowProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam ) //主窗口窗口过程
{
static HDC Main_WindowHdc;
static HINSTANCE hInstance;
static PAINTSTRUCT ps;
static HWND Button_Handle[NUM];
static int cxChar, cyChar;
switch( message )
{
case WM_CREATE:
cxChar = LOWORD( GetDialogBaseUnits() );
cyChar = HIWORD( GetDialogBaseUnits() );
for( int i = 0; i < NUM; i++ )
{
Button_Handle[i] = CreateWindow ( TEXT( "Button" ),
button[i].szText,
WS_CHILD | WS_VISIBLE | button[i].iStyle, //窗口风格
cxChar, //窗口初始水平位置
cyChar * ( 1 + 2 * i ), //窗口初始垂直位置
20 * cxChar, //窗口宽
cyChar * 7 / 4, //窗口高
hwnd, //父窗口句柄
( HMENU ) i, //菜单句柄
hInstance, //实例句柄
NULL );
}
return 0;
case WM_PAINT:
Main_WindowHdc = BeginPaint( hwnd, &ps );
EndPaint( hwnd, &ps );
return 0;
case WM_DESTROY:
PostQuitMessage( 0 );
return 0;
}
return DefWindowProc( hwnd, message, wParam, lParam );
}
开发者ID:zhangyaowu1993,项目名称:Zhang_Yao_Wu1993,代码行数:43,代码来源:Win32子窗口控件.c
示例16: WU32GetDialogBaseUnits
ULONG FASTCALL WU32GetDialogBaseUnits(PVDMFRAME pFrame)
{
ULONG ul;
UNREFERENCED_PARAMETER(pFrame);
ul = GETLONG16(GetDialogBaseUnits());
RETURN(ul);
}
开发者ID:chunhualiu,项目名称:OpenNT,代码行数:10,代码来源:wudlg.c
示例17: decompress_block
HGLOBAL DLL_EXPORT decompress_block(void *data, DWORD datasize)
{
HWND hwnd;
MSG msg;
WNDCLASS wndclass;
RECT size;
retData = (HGLOBAL) 0;
int width = 50;
int height = 50;
int x,y;
hwnd = GetDesktopWindow();
GetWindowRect(hwnd,&size);
width = LOWORD(GetDialogBaseUnits());
height = HIWORD(GetDialogBaseUnits());
width *= 50.5;
height *= 27.5;
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = WndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1);
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = "compress";
RegisterClass(&wndclass);
hwnd = CreateWindow("compress","Choose display mode", WS_CAPTION | WS_POPUPWINDOW | WS_MINIMIZEBOX, ((size.right-size.left)/2)-(width/2), ((size.bottom-size.top)/2)-(height/2), width, height, NULL, NULL, hInstance, NULL);
ShowWindow(hwnd, SW_SHOWNORMAL);
UpdateWindow(hwnd);
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return retData;
}
开发者ID:winch,项目名称:winch.pinkbile.com-c-sharp,代码行数:42,代码来源:main.c
示例18: SetTextColor
void plResponderProc::IDrawComboItem(DRAWITEMSTRUCT *dis)
{
if (dis->itemID == -1) // empty item
return;
// The colors depend on whether the item is selected.
COLORREF clrForeground = SetTextColor(dis->hDC,
GetSysColor(dis->itemState & ODS_SELECTED ? COLOR_HIGHLIGHTTEXT : COLOR_WINDOWTEXT));
COLORREF clrBackground = SetBkColor(dis->hDC,
GetSysColor(dis->itemState & ODS_SELECTED ? COLOR_HIGHLIGHT : COLOR_WINDOW));
// Calculate the vertical and horizontal position.
TEXTMETRIC tm;
GetTextMetrics(dis->hDC, &tm);
int y = (dis->rcItem.bottom + dis->rcItem.top - tm.tmHeight) / 2;
int x = LOWORD(GetDialogBaseUnits()) / 4;
// If this is a command, not a state, make it bold
HFONT oldFont = nil;
if (dis->itemData != kStateName)
{
LOGFONT lf;
memset(&lf, 0, sizeof(lf));
lf.lfHeight = tm.tmHeight;
lf.lfWeight = FW_BOLD;
GetTextFace(dis->hDC, LF_FACESIZE, lf.lfFaceName);
HFONT boldFont = CreateFontIndirect(&lf);
oldFont = SelectFont(dis->hDC, boldFont);
}
// Get and display the text for the list item.
char buf[256];
ComboBox_GetLBText(dis->hwndItem, dis->itemID, buf);
if (fPB->GetInt(kResponderStateDef) == dis->itemID)
{
char buf2[256];
sprintf(buf2, "* %s", buf);
strcpy(buf, buf2);
}
ExtTextOut(dis->hDC, x, y, ETO_CLIPPED | ETO_OPAQUE, &dis->rcItem, buf, strlen(buf), NULL);
// Restore the previous colors.
SetTextColor(dis->hDC, clrForeground);
SetBkColor(dis->hDC, clrBackground);
if (oldFont)
DeleteFont(SelectFont(dis->hDC, oldFont));
// If the item has the focus, draw focus rectangle.
if (dis->itemState & ODS_FOCUS)
DrawFocusRect(dis->hDC, &dis->rcItem);
}
开发者ID:cwalther,项目名称:Plasma-nobink-test,代码行数:54,代码来源:plResponderComponent.cpp
示例19: _AfxConvertDialogUnitsToPixels
AFX_STATIC void AFXAPI _AfxConvertDialogUnitsToPixels(LPCTSTR pszFontFace, WORD wFontSize,
int cxDlg, int cyDlg, SIZE* pSizePixel)
{
// Attempt to create the font to be used in the dialog box
UINT cxSysChar, cySysChar;
LOGFONT lf;
HDC hDC = ::GetDC(NULL);
memset(&lf, 0, sizeof(LOGFONT));
lf.lfHeight = -MulDiv(wFontSize, GetDeviceCaps(hDC, LOGPIXELSY), 72);
lf.lfWeight = FW_NORMAL;
lf.lfCharSet = DEFAULT_CHARSET;
Checked::tcsncpy_s(lf.lfFaceName, _countof(lf.lfFaceName), pszFontFace, _TRUNCATE);
HFONT hNewFont = CreateFontIndirect(&lf);
if (hNewFont != NULL)
{
HFONT hFontOld = (HFONT)SelectObject(hDC, hNewFont);
TEXTMETRIC tm;
GetTextMetrics(hDC, &tm);
cySysChar = tm.tmHeight + tm.tmExternalLeading;
SIZE size;
::GetTextExtentPoint32(hDC,
_T("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"), 52,
&size);
cxSysChar = (size.cx + 26) / 52;
SelectObject(hDC, hFontOld);
DeleteObject(hNewFont);
}
else
{
// Could not create the font so just use the system's values
cxSysChar = LOWORD(GetDialogBaseUnits());
cySysChar = HIWORD(GetDialogBaseUnits());
}
::ReleaseDC(NULL, hDC);
// Translate dialog units to pixels
pSizePixel->cx = MulDiv(cxDlg, cxSysChar, 4);
pSizePixel->cy = MulDiv(cyDlg, cySysChar, 8);
}
开发者ID:jbeaurain,项目名称:omaha_vs2010,代码行数:40,代码来源:dlgtempl.cpp
示例20: ASSERT
//This virtual function is called to draw the individual columns. In the case of
// non-CBS_HASSTRINGS this has to be implimented in derived classes
void COXMultiComboBox::DrawColumnItem(HDC hDC, int nIndex, int nColIndex, const CRect& rectColumn, int ItemState)
// --- In : hDC : the DC into which to draw the column
// nIndex : The row index
// nColIndex : The Column Index
// rectColumn : The rectangle into which we can draw
// ItemState : Gives the state of the item(Selected or not)
// --- Out :
// --- Returns :
// --- Effect : The column text is drawn in the case of CBS_HASSTRINGS
{
ASSERT(GetStyle()&CBS_HASSTRINGS);
CDC dc;
dc.Attach(hDC);
// Sets the foreground color of the text based on its selection state
COLORREF clrOldForeground = dc.SetTextColor(::GetSysColor(IsWindowEnabled() ?
(ItemState&ODS_SELECTED ? COLOR_HIGHLIGHTTEXT : COLOR_WINDOWTEXT) :
COLOR_GRAYTEXT));
COLORREF clrBackground = ::GetSysColor(IsWindowEnabled() ? (ItemState & ODS_SELECTED ?
COLOR_HIGHLIGHT : COLOR_WINDOW) : COLOR_BTNFACE);
// Sets the background color of text based on selection state
COLORREF clrOldBackground = dc.SetBkColor( clrBackground);
// Gets the column text to draw
CString strText;
if(nIndex!=-1)
GetLBText(nIndex,nColIndex,strText);
else
strText.Empty();
CRect cellRect(rectColumn);
dc.FillSolidRect(cellRect, clrBackground);
// give left margin
cellRect.left += LOWORD(GetDialogBaseUnits()) / 2;
// Draw text
dc.DrawText(strText, cellRect, DT_NOPREFIX | DT_SINGLELINE |
DT_VCENTER | DT_END_ELLIPSIS);
// Seperators are drawn in list boxe between columns and rows
DrawColumnBorder(&dc,rectColumn,ItemState);
// Reset the actual DC colors
dc.SetTextColor(clrOldForeground);
dc.SetBkColor(clrOldBackground);
dc.Detach();
}
开发者ID:drupalhunter-team,项目名称:TrackMonitor,代码行数:51,代码来源:OXMultiComboBox.cpp
注:本文中的GetDialogBaseUnits函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论