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

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

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

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

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

示例1: Contour

void ViewPort::DrawActiveDomain( double pixel_size, double offset_x, double offset_y ){	Transform *transform;								// render all transforms in section	HPEN pen, oldpen;	HBRUSH brush, oldbrush;	LOGBRUSH lbrush;	int oldmode, i, x, y, numpts;	Contour *contour, *c;	Point *p;	POINT *lpPoints;	if ( section && viewDC )							// need a drawing surface for domain contour	  if ( section->active )							// do only if have an active transform		{		transform = section->active;		if ( transform->domain )						// do only if have domain			{			contour = transform->domain;			if ( contour->points )				{				c = new Contour( *contour );					// copy the contour																// if image, then contour is in pixels				if ( transform->image ) c->Scale( transform->image->mag );				c->InvNform( transform->nform );				// transform into section				c->Shift( -offset_x, -offset_y );				// shift into view				c->Scale( 1.0/pixel_size );						// scale to view's pixels									numpts = c->points->Number();				lpPoints = new POINT[ numpts ];					// create Window POINT array for drawing				i = 0;				p = c->points->first;				while ( p != NULL )					{					lpPoints[i].x = (int)floor(p->x);					lpPoints[i].y = height - (int)floor(p->y);					i++;					p = p->next;					}																// create pen for border of object				pen = CreatePen( PS_SOLID, 1, c->border.ref() );				oldpen = (HPEN)SelectObject( viewDC, pen );		// set pen into device context				if ( c->mode < 0 )					{					brush = CreateSolidBrush( c->fill.ref() );	// interior will be filled					oldbrush = (HBRUSH)SelectObject( viewDC, brush );					SetROP2( viewDC, abs(c->mode) );			// using contour fill mode and color					Polygon( viewDC, lpPoints, numpts );					SelectObject( viewDC, oldbrush );			// clean up fill brush					DeleteObject(brush);					}				SelectObject( viewDC, (HBRUSH)GetStockObject(NULL_BRUSH) );	// without coloring interior				SetROP2( viewDC, R2_COPYPEN );								// draw contour border with pen				if ( c->closed ) Polygon( viewDC, lpPoints, numpts );				else Polyline( viewDC, lpPoints, numpts );								SelectObject( viewDC, oldpen );					// clean up pen				DeleteObject(pen);				delete[] lpPoints;								// and dynamic memory				delete c;				}			}		}}
开发者ID:meawoppl,项目名称:reconstruct-1101,代码行数:67,


示例2: CreateDC

BOOL MusicUtils::SaveBitMapToFile(HBITMAP hBitmap, CString lpFileName){	HDC		hDC;		//?????       	int		iBits;		//?????????????????   	WORD	wBitCount;	//????????????   	DWORD	dwPaletteSize=0,//???????,?????????,??????,???????		dwBmBitsSize,		dwDIBSize,		dwWritten;	BITMAP	Bitmap;      	BITMAPFILEHEADER	bmfHdr;	//??????	BITMAPINFOHEADER	bi;		//???????                	LPBITMAPINFOHEADER	lpbi;	//???????           	HANDLE	fh,   hDib,   hPal,hOldPal=NULL;//?????????,????,??????,?????	//???????????????   	hDC = CreateDC(_T("DISPLAY"),NULL,NULL,NULL);   	iBits = GetDeviceCaps(hDC,BITSPIXEL)*GetDeviceCaps(hDC,PLANES);   	DeleteDC(hDC);	if(iBits<=1)   		wBitCount = 1;   	else if(iBits<=4)   		wBitCount = 4;   	else if(iBits<=8)   		wBitCount = 8;	else if(iBits<=24)   		wBitCount = 24;	else		wBitCount = 32;	//???????   	if(wBitCount<=8)   		dwPaletteSize = (1<<wBitCount)*sizeof(RGBQUAD);   	//?????????	GetObject(hBitmap, sizeof(BITMAP), (LPSTR)&Bitmap);   	bi.biSize = sizeof(BITMAPINFOHEADER);	bi.biWidth = Bitmap.bmWidth;   	bi.biHeight = Bitmap.bmHeight;   	bi.biPlanes = 1;   	bi.biBitCount = wBitCount;   	bi.biCompression = BI_RGB;   	bi.biSizeImage = 0;   	bi.biXPelsPerMeter = 0;   	bi.biYPelsPerMeter = 0;   	bi.biClrUsed = 0;   	bi.biClrImportant = 0;   	dwBmBitsSize = ((Bitmap.bmWidth*wBitCount+31)/32)*4*Bitmap.bmHeight;   	//?????????   	hDib = GlobalAlloc(GHND,dwBmBitsSize+dwPaletteSize+sizeof(BITMAPINFOHEADER));   	lpbi = (LPBITMAPINFOHEADER)GlobalLock(hDib);   	*lpbi = bi;   	//   ?????         	hPal = GetStockObject(DEFAULT_PALETTE);   	if(hPal)	{   		hDC = ::GetDC(NULL);   		hOldPal = SelectPalette(hDC, (HPALETTE)hPal, FALSE);   		RealizePalette(hDC);  	}   	//   ????????????   	GetDIBits(hDC, hBitmap, 0, (UINT)Bitmap.bmHeight,		(LPSTR)lpbi+sizeof(BITMAPINFOHEADER)+dwPaletteSize,		(LPBITMAPINFO)lpbi,DIB_RGB_COLORS);   	//?????         	if(hOldPal)	{		SelectPalette(hDC,(HPALETTE)hOldPal,TRUE);		RealizePalette(hDC);		::ReleaseDC(NULL, hDC);	}   	//??????           	fh = CreateFile(lpFileName,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,		FILE_ATTRIBUTE_NORMAL|FILE_FLAG_SEQUENTIAL_SCAN,NULL);	if(fh==INVALID_HANDLE_VALUE)		return   FALSE;	//   ???????   	bmfHdr.bfType = 0x4D42;//   "BM"   	dwDIBSize = sizeof(BITMAPFILEHEADER)+		sizeof(BITMAPINFOHEADER)+		dwPaletteSize+dwBmBitsSize;	bmfHdr.bfSize = dwDIBSize;	bmfHdr.bfReserved1 = 0;	bmfHdr.bfReserved2 = 0;	bmfHdr.bfOffBits = (DWORD)sizeof(BITMAPFILEHEADER)+		(DWORD)sizeof(BITMAPINFOHEADER)+dwPaletteSize;	//   ???????	WriteFile(fh,(LPSTR)&bmfHdr,sizeof(BITMAPFILEHEADER),&dwWritten,NULL);	//   ??????????	WriteFile(fh,(LPSTR)lpbi,dwDIBSize,&dwWritten,NULL);	//??????	GlobalUnlock(hDib);//.........这里部分代码省略.........
开发者ID:ltframe,项目名称:ltplayer0016,代码行数:101,


示例3: memset

/*** Responsible for drawing each list item.*/void ToggleListView::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) {	CListCtrl& ListCtrl=GetListCtrl();	int nItem = lpDrawItemStruct->itemID;		// get item data	LV_ITEM lvi;	_TCHAR szBuff[MAX_PATH];		memset(&lvi, 0, sizeof(LV_ITEM));	lvi.mask = LVIF_TEXT;	lvi.iItem = nItem;	lvi.pszText = szBuff;	lvi.cchTextMax = sizeof(szBuff);	ListCtrl.GetItem(&lvi);	RECT rDraw;			CopyRect ( &rDraw, &lpDrawItemStruct->rcItem );	rDraw.right = rDraw.left + TOGGLELIST_ITEMHEIGHT;	rDraw.top ++;	rDraw.right ++;	FrameRect ( lpDrawItemStruct->hDC, &rDraw, (HBRUSH)GetStockObject ( BLACK_BRUSH ) );	rDraw.right --;	FillRect ( lpDrawItemStruct->hDC, &rDraw, GetSysColorBrush ( COLOR_3DFACE ) );	Draw3dRect ( lpDrawItemStruct->hDC, &rDraw, GetSysColorBrush ( COLOR_3DHILIGHT ), GetSysColorBrush ( COLOR_3DSHADOW ) );	InflateRect ( &rDraw, -3, -3 );	Draw3dRect ( lpDrawItemStruct->hDC, &rDraw, GetSysColorBrush ( COLOR_3DSHADOW ), GetSysColorBrush ( COLOR_3DHILIGHT ) );	switch(GetToggleState(lvi.iItem)) {		case TOGGLE_STATE_DISABLED:			if(disabledIcon) {				DrawIconEx ( lpDrawItemStruct->hDC, rDraw.left, rDraw.top, disabledIcon, 16, 16,0, NULL, DI_NORMAL );			}			break;		case TOGGLE_STATE_ON:			if(onIcon) {				DrawIconEx ( lpDrawItemStruct->hDC, rDraw.left, rDraw.top, onIcon, 16, 16,0, NULL, DI_NORMAL );			}			break;		case TOGGLE_STATE_OFF:			if(offIcon) {				DrawIconEx ( lpDrawItemStruct->hDC, rDraw.left, rDraw.top, offIcon, 16, 16,0, NULL, DI_NORMAL );			}			break;	};		CopyRect ( &rDraw, &lpDrawItemStruct->rcItem );	rDraw.left += TOGGLELIST_ITEMHEIGHT;	rDraw.left += 1;	if ( lpDrawItemStruct->itemState & ODS_SELECTED ) {		FillRect ( lpDrawItemStruct->hDC, &rDraw, GetSysColorBrush ( COLOR_HIGHLIGHT ) );				} else {		FillRect ( lpDrawItemStruct->hDC, &rDraw, GetSysColorBrush ( COLOR_WINDOW ) ); 	}	rDraw.left += TEXT_OFFSET;	int colorIndex = ( (lpDrawItemStruct->itemState & ODS_SELECTED ) ? COLOR_HIGHLIGHTTEXT : COLOR_WINDOWTEXT );	SetTextColor ( lpDrawItemStruct->hDC, GetSysColor ( colorIndex ) );	DrawText ( lpDrawItemStruct->hDC, szBuff, strlen(szBuff), &rDraw, DT_LEFT|DT_VCENTER|DT_SINGLELINE );}
开发者ID:0culus,项目名称:Doom3-for-MacOSX-,代码行数:72,


示例4: WinMain

int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hprev, PSTR cmdline, int ishow){    HWND hwnd;    MSG msg;    WNDCLASSEX wndclassex = {0};    // Fill the WNDCLASSEX fields we care about    wndclassex.cbSize = sizeof(WNDCLASSEX);    wndclassex.style = CS_HREDRAW | CS_VREDRAW; // Redraw the window if it's position or size changes    wndclassex.lpfnWndProc = WinProc;    wndclassex.hInstance = hinstance;    wndclassex.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); // Make the window background white    wndclassex.lpszClassName = kClassName;    wndclassex.hCursor = (HCURSOR)LoadImage(NULL, MAKEINTRESOURCE(IDC_ARROW), IMAGE_CURSOR,                                            0, 0, LR_SHARED); // Load the default arrow cursor    RegisterClassEx(&wndclassex); // Register the WNDCLASSEX with the OS    // Here we set the style of the window    // Notice how we use the style WS_VSCROLL, this creates the window with a    // vertical scroll bar    DWORD style = WS_SYSMENU | WS_VSCROLL;    // Create the window    hwnd = CreateWindowEx(WS_EX_CLIENTEDGE, // Our Window has a border with a sunken edge                          kClassName,                          "www.GameTutorials.com -- Vertical Scroll Bar",                          style, // Style of window                          CW_USEDEFAULT, // Windows picks upper-left X-pos of window                          CW_USEDEFAULT, // Windows picks upper-left Y-pos of window                          kWinWid,                          kWinHgt,                          NULL,                          NULL,                          hinstance,                          NULL);    // Error Check    if(hwnd == NULL)        return EXIT_FAILURE; // Couldn't create the window    // Load a the text file for displaying    if(!LoadTextFile("VerticalText.txt"))        return EXIT_FAILURE; // No text file, no tutorial    // Show and update the window    ShowWindow(hwnd, ishow);    UpdateWindow(hwnd);    while(1)    {        // Checking for window messages -- If we get one we'll deal with it        if(PeekMessage(&msg,NULL,0,0,PM_REMOVE))        {            if(msg.message == WM_QUIT)                break;            TranslateMessage(&msg);            DispatchMessage(&msg);        }        else        {            // This is where the core of our application would go if we were writing one...        }    } // end of while(1)    UnregisterClass(kClassName,hinstance); // Free up memory    return msg.wParam;}
开发者ID:jiangguang5201314,项目名称:ZNginx,代码行数:70,


示例5: InterfaceCreateTabControl

void InterfaceCreateTabControl(HWND hwnd) {     TC_ITEM tie;     char s[100];    HWND hwndCtl;    LOGFONT lf;    HFONT font;        hwndTab = GetDlgItem(hwndMain,IDC_TAB_MAIN);	    tie.mask = TCIF_TEXT | TCIF_IMAGE;     tie.iImage = -1;     tie.pszText = s;	    tie.pszText = "&Status";    TabCtrl_InsertItem(hwndTab,0, &tie);    tie.pszText = "&Channels";    TabCtrl_InsertItem(hwndTab,1, &tie);    tie.pszText = "&Administration";    TabCtrl_InsertItem(hwndTab,2, &tie);	    tab_pages[0] = CreateDialog(hInst,MAKEINTRESOURCE(IDD_TAB_PAGE_STATUS),hwndTab,		InterfaceDialogTabPage);    tab_pages[1] = CreateDialog(hInst,MAKEINTRESOURCE(IDD_TAB_PAGE_CHANNELS),hwndTab,		InterfaceDialogTabPage);    tab_pages[2] = CreateDialog(hInst,MAKEINTRESOURCE(IDD_TAB_PAGE_ADMINISTRATION),hwndTab,		InterfaceDialogTabPage);	    /* keep about box page ready */    tab_about = CreateDialog(hInst,MAKEINTRESOURCE(IDD_ABOUT),hwnd,			     InterfaceDialogAbout);		    /* set admin page font */    hwndCtl = GetDlgItem(HWND_ADMIN,IDC_ADMIN_RESPONSE);    SendMessage(hwndCtl,WM_SETFONT,(WPARAM)GetStockObject(ANSI_FIXED_FONT),		MAKELPARAM(TRUE,0));	    lf.lfHeight = 8;    lf.lfWidth = 0;    lf.lfEscapement = 0;    lf.lfOrientation = 0;    lf.lfWeight = 400;    lf.lfItalic = 0;     lf.lfUnderline = 0;    lf.lfStrikeOut = 0;    lf.lfCharSet = 255;    lf.lfOutPrecision = 1;    lf.lfClipPrecision = 2;    lf.lfQuality = 1;    lf.lfPitchAndFamily = 49;    strcpy(lf.lfFaceName,"Terminal");        font = CreateFontIndirect(&lf);    if (font != NULL)    {		SendMessage(hwndCtl,WM_SETFONT,(WPARAM)font,MAKELPARAM(TRUE,0));    }    /* Set text buffer to be large */    SendMessage(hwndCtl, EM_EXLIMITTEXT, ADMIN_RESPONSE_SIZE, 0);        lpfnDefAdminResponseProc = SubclassWindow(hwndCtl,InterfaceAdminResponseProc);	    hwndCtl = GetDlgItem(HWND_ADMIN,IDC_ADMIN_COMMAND);    lpfnDefAdminInputProc = SubclassWindow(hwndCtl,InterfaceAdminInputProc);	    hwndTab_page = NULL;	    InterfaceTabChange();}
开发者ID:Shaijan,项目名称:Meridian59,代码行数:71,


示例6: winCreateBoundingWindowWindowed

BoolwinCreateBoundingWindowWindowed(ScreenPtr pScreen){    winScreenPriv(pScreen);    winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;    int iWidth = pScreenInfo->dwUserWidth;    int iHeight = pScreenInfo->dwUserHeight;    int iPosX;    int iPosY;    HWND *phwnd = &pScreenPriv->hwndScreen;    WNDCLASSEX wc;    RECT rcClient, rcWorkArea;    DWORD dwWindowStyle;    BOOL fForceShowWindow = FALSE;    char szTitle[256];    winDebug("winCreateBoundingWindowWindowed - User w: %d h: %d/n",             (int) pScreenInfo->dwUserWidth, (int) pScreenInfo->dwUserHeight);    winDebug("winCreateBoundingWindowWindowed - Current w: %d h: %d/n",             (int) pScreenInfo->dwWidth, (int) pScreenInfo->dwHeight);    /* Set the common window style flags */    dwWindowStyle = WS_OVERLAPPED | WS_SYSMENU | WS_MINIMIZEBOX;    /* Decorated or undecorated window */    if (pScreenInfo->fDecoration#ifdef XWIN_MULTIWINDOWEXTWM        && !pScreenInfo->fMWExtWM#endif        && !pScreenInfo->fRootless#ifdef XWIN_MULTIWINDOW        && !pScreenInfo->fMultiWindow#endif        ) {        /* Try to handle startup via run.exe. run.exe instructs Windows to         * hide all created windows. Detect this case and make sure the         * window is shown nevertheless */        STARTUPINFO startupInfo;        GetStartupInfo(&startupInfo);        if (startupInfo.dwFlags & STARTF_USESHOWWINDOW &&            startupInfo.wShowWindow == SW_HIDE) {            fForceShowWindow = TRUE;        }        dwWindowStyle |= WS_CAPTION;        if (pScreenInfo->iResizeMode != notAllowed)            dwWindowStyle |= WS_THICKFRAME | WS_MAXIMIZEBOX;    }    else        dwWindowStyle |= WS_POPUP;    /* Setup our window class */    wc.cbSize = sizeof(WNDCLASSEX);    wc.style = CS_HREDRAW | CS_VREDRAW;    wc.lpfnWndProc = winWindowProc;    wc.cbClsExtra = 0;    wc.cbWndExtra = 0;    wc.hInstance = g_hInstance;    wc.hIcon =        (HICON) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON,                          GetSystemMetrics(SM_CXICON),                          GetSystemMetrics(SM_CYICON), 0);    wc.hCursor = 0;    wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);    wc.lpszMenuName = NULL;    wc.lpszClassName = WINDOW_CLASS;    wc.hIconSm =        (HICON) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON,                          GetSystemMetrics(SM_CXSMICON),                          GetSystemMetrics(SM_CYSMICON), LR_DEFAULTSIZE);    RegisterClassEx(&wc);    /* Get size of work area */    winGetWorkArea(&rcWorkArea, pScreenInfo);    /* Adjust for auto-hide taskbars */    winAdjustForAutoHide(&rcWorkArea, pScreenInfo);    /* Did the user specify a position? */    if (pScreenInfo->fUserGavePosition) {        iPosX = pScreenInfo->dwInitialX;        iPosY = pScreenInfo->dwInitialY;    }    else {        iPosX = rcWorkArea.left;        iPosY = rcWorkArea.top;    }    /* Clean up the scrollbars flag, if necessary */    if ((!pScreenInfo->fDecoration#ifdef XWIN_MULTIWINDOWEXTWM         || pScreenInfo->fMWExtWM#endif         || pScreenInfo->fRootless#ifdef XWIN_MULTIWINDOW         || pScreenInfo->fMultiWindow#endif        )        && (pScreenInfo->iResizeMode == resizeWithScrollbars)) {        /* We cannot have scrollbars if we do not have a window border *///.........这里部分代码省略.........
开发者ID:AmesianX,项目名称:xorg-server,代码行数:101,


示例7: WinMain

int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hprev, PSTR cmdline, int ishow){  	HWND hwnd;    MSG msg;    WNDCLASSEX wndclassex = {0};	SDBuffer doubleBuff = {0}; // This is our "double buffer" struct	// Fill the fields we care about	wndclassex.cbSize = sizeof(WNDCLASSEX);    wndclassex.style = CS_HREDRAW | CS_VREDRAW;    wndclassex.lpfnWndProc = WinProc;    wndclassex.hInstance = hinstance;    wndclassex.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);    wndclassex.lpszClassName = class_name;    wndclassex.hCursor = (HCURSOR)LoadImage(NULL, MAKEINTRESOURCE(IDC_ARROW), IMAGE_CURSOR,											0, 0, LR_SHARED); // Load the default arrow cursor    RegisterClassEx(&wndclassex); // Register the window    hwnd = CreateWindowEx(NULL, // No extra window attributes						  class_name,						  "www.GameTutorials.com -- Double Buffering",						  WS_OVERLAPPEDWINDOW,						  CW_USEDEFAULT, // Window will receive a default x pos on screen						  CW_USEDEFAULT, // Window will receive a default y pos on screen						  WIN_WID,						  WIN_HGT,						  NULL,						  NULL,						  hinstance,						  NULL);		// Error check		if(!hwnd)			return EXIT_FAILURE; // Something really bad happened!			doubleBuff.win_hwnd = hwnd; // Set the HWND of our double buffer struct	// Attempt to initialize our double buffering	if(!InitDoubleBuffer(doubleBuff))		return EXIT_FAILURE; // Couldn't set up double buffering		// Here we'll load up our bitmap	HBITMAP img_bmp = (HBITMAP)LoadImage(hinstance,"AnImage.bmp",IMAGE_BITMAP,										 0,0,LR_LOADFROMFILE);		// Error Check		if(!img_bmp)			return EXIT_FAILURE; // Couldn't load our image			// Create a compatible HDC so that we can draw our "img_bmp"	HDC img_dc = CreateCompatibleDC(doubleBuff.win_dc);				if(!img_dc)			return EXIT_FAILURE;			// Select our "img_bmp" into the "img_dc"	HBITMAP old_bmp = (HBITMAP)SelectObject(img_dc,img_bmp);    ShowWindow(hwnd, ishow);    UpdateWindow(hwnd);      while(1)	{		// Check message(s) if there are any		if(PeekMessage(&msg,NULL,0,0,PM_REMOVE))		{			if(msg.message == WM_QUIT)				break;							TranslateMessage(&msg);			DispatchMessage(&msg);		}		else if(LockFrameRate())		{			#if DOUBLE_BUFFER // If we are using double buffering				// First we fill our back buffer to solid white (the same color as the				// background color of our window)				FillRect(doubleBuff.back_dc,&doubleBuff.rect,(HBRUSH)GetStockObject(WHITE_BRUSH));				// Next we'll draw the bitmap to our back buffer				BitBlt(doubleBuff.back_dc,gXPos,gYPos,gXPos + IMG_WID,					   gYPos + IMG_HGT,img_dc,0,0,SRCCOPY);				// Then we draw the back buffer to the front buffer (our window)				BitBlt(doubleBuff.win_dc,0,0,doubleBuff.rect.right,					   doubleBuff.rect.bottom,doubleBuff.back_dc,0,0,SRCCOPY);			#else // No double buffering in use				// We fill our window with solid white so we can clear away the "old"				// position of the image				FillRect(doubleBuff.win_dc,&doubleBuff.rect,(HBRUSH)GetStockObject(WHITE_BRUSH));				// Blit the image to the window				BitBlt(doubleBuff.win_dc,gXPos,gYPos,gXPos + IMG_WID,					   gYPos + IMG_HGT,img_dc,0,0,SRCCOPY);//.........这里部分代码省略.........
开发者ID:Allenjonesing,项目名称:tutorials,代码行数:101,


示例8: WndProc

LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){	static POINT apt[4] ;	HDC          hdc ;	int          cxClient, cyClient ;	PAINTSTRUCT  ps ;	switch (message)	{	case WM_SIZE:		cxClient = LOWORD (lParam) ;		cyClient = HIWORD (lParam) ;		apt[0].x = cxClient / 4 ;		apt[0].y = cyClient / 2 ;		apt[1].x = cxClient / 2 ;		apt[1].y = cyClient / 4 ;		apt[2].x = cxClient / 2 ;		apt[2].y = 3 * cyClient / 4 ;		apt[3].x = 3 * cxClient / 4 ;		apt[3].y = cyClient / 2 ;		return 0 ;	case WM_LBUTTONDOWN:	case WM_RBUTTONDOWN:	case WM_MOUSEMOVE:		if (wParam & MK_LBUTTON || wParam & MK_RBUTTON)		{			hdc = GetDC (hwnd) ;			SelectObject (hdc, GetStockObject (WHITE_PEN)) ;			DrawBezier (hdc, apt) ;			if (wParam & MK_LBUTTON)			{				apt[1].x = LOWORD (lParam) ;				apt[1].y = HIWORD (lParam) ;			}			if (wParam & MK_RBUTTON)			{				apt[2].x = LOWORD (lParam) ;				apt[2].y = HIWORD (lParam) ;			}			SelectObject (hdc, GetStockObject (BLACK_PEN)) ;			DrawBezier (hdc, apt) ;			ReleaseDC (hwnd, hdc) ;//.........这里部分代码省略.........
开发者ID:chenhz2284,项目名称:cpp_lib,代码行数:101,


示例9: WinMain

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,	PSTR szCmdLine, int iCmdShow){	static TCHAR szAppName[] = TEXT ("Bezier") ;	HWND          hwnd ;	MSG           msg ;	WNDCLASS      wndclass ;	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) GetStockObject (WHITE_BRUSH) ;	wndclass.lpszMenuName= NULL ;	wndclass.lpszClassName= szAppName ;	if (!RegisterClass (&wndclass))	{		MessageBox (NULL, TEXT ("Program requires Windows NT!"),			szAppName, MB_ICONERROR) ;		return 0 ;	}	hwnd = CreateWindow (szAppName, TEXT ("Bezier Splines"),		WS_OVERLAPPEDWINDOW,		CW_USEDEFAULT, CW_USEDEFAULT,		CW_USEDEFAULT, CW_USEDEFAULT,		NULL, NULL, hInstance, NULL) ;	ShowWindow (hwnd, iCmdShow) ;	UpdateWindow (hwnd) ;	while (GetMessage (&msg, NULL, 0, 0))	{		TranslateMessage (&msg) ;		DispatchMessage (&msg) ;	}	return msg.wParam ;}
开发者ID:chenhz2284,项目名称:cpp_lib,代码行数:82,


示例10: GetClientRect

//.........这里部分代码省略.........			bounds.left = bounds.right = 0;			bounds.top = row * metrics().debug_font_height();			bounds.bottom = bounds.top + metrics().debug_font_height();			// start with a brush on iteration #0			if (iter == 0)				bgbrush = CreateSolidBrush(bgcolor);			// iterate over columns			for (UINT32 col = 0; col < visarea.x; col++)			{				// if the attribute changed, adjust the colors				if (viewdata[col].attrib != last_attrib)				{					COLORREF oldbg = bgcolor;					// reset to standard colors					fgcolor = RGB(0x00,0x00,0x00);					bgcolor = RGB(0xff,0xff,0xff);					// pick new fg/bg colors					if (viewdata[col].attrib & DCA_VISITED) bgcolor = RGB(0xc6, 0xe2, 0xff);					if (viewdata[col].attrib & DCA_ANCILLARY) bgcolor = RGB(0xe0,0xe0,0xe0);					if (viewdata[col].attrib & DCA_SELECTED) bgcolor = RGB(0xff,0x80,0x80);					if (viewdata[col].attrib & DCA_CURRENT) bgcolor = RGB(0xff,0xff,0x00);					if ((viewdata[col].attrib & DCA_SELECTED) && (viewdata[col].attrib & DCA_CURRENT)) bgcolor = RGB(0xff,0xc0,0x80);					if (viewdata[col].attrib & DCA_CHANGED) fgcolor = RGB(0xff,0x00,0x00);					if (viewdata[col].attrib & DCA_INVALID) fgcolor = RGB(0x00,0x00,0xff);					if (viewdata[col].attrib & DCA_DISABLED) fgcolor = RGB((GetRValue(fgcolor) + GetRValue(bgcolor)) / 2, (GetGValue(fgcolor) + GetGValue(bgcolor)) / 2, (GetBValue(fgcolor) + GetBValue(bgcolor)) / 2);					if (viewdata[col].attrib & DCA_COMMENT) fgcolor = RGB(0x00,0x80,0x00);					// flush any pending drawing					if (count > 0)					{						bounds.right = bounds.left + (count * metrics().debug_font_width());						if (iter == 0)							FillRect(dc, &bounds, bgbrush);						else							ExtTextOut(dc, bounds.left, bounds.top, 0, nullptr, buffer, count, nullptr);						bounds.left = bounds.right;						count = 0;					}					// set the new colors					if (iter == 0 && oldbg != bgcolor)					{						DeleteObject(bgbrush);						bgbrush = CreateSolidBrush(bgcolor);					}					else if (iter == 1)						SetTextColor(dc, fgcolor);					last_attrib = viewdata[col].attrib;				}				// add this character to the buffer				buffer[count++] = viewdata[col].byte;			}			// flush any remaining stuff			if (count > 0)			{				bounds.right = bounds.left + (count * metrics().debug_font_width());				if (iter == 0)					FillRect(dc, &bounds, bgbrush);				else					ExtTextOut(dc, bounds.left, bounds.top, 0, nullptr, buffer, count, nullptr);			}			// erase to the end of the line			if (iter == 0)			{				bounds.left = bounds.right;				bounds.right = client.right;				FillRect(dc, &bounds, bgbrush);				DeleteObject(bgbrush);			}		}		// advance viewdata		viewdata += visarea.x;	}	// erase anything beyond the bottom with white	GetClientRect(m_wnd, &client);	client.top = visarea.y * metrics().debug_font_height();	FillRect(dc, &client, (HBRUSH)GetStockObject(WHITE_BRUSH));	// reset the font	SetBkMode(dc, oldbkmode);	SetTextColor(dc, oldfgcolor);	SelectObject(dc, oldfont);	// blit the final results	BitBlt(windc, 0, 0, client.right, client.bottom, dc, 0, 0, SRCCOPY);	// undo the offscreen stuff	SelectObject(dc, oldbitmap);	DeleteObject(bitmap);	DeleteDC(dc);}
开发者ID:RalfVB,项目名称:mame,代码行数:101,


示例11: smileys

HRESULT CGifSmileyCtrl::OnDrawSmiley(ATL_DRAWINFO& di, bool bCustom=false){	USES_CONVERSION;	if (di.dwDrawAspect != DVASPECT_CONTENT)	{		return E_FAIL;	}	if ( bCustom && !IsVisible(di))	{		return S_OK;	}	if (!m_pGifImage)	{		return E_FAIL;	}	RECT& rc = *(RECT*)di.prcBounds;	HRGN hOldRgn, hNewRgn;	if (!IsRectEmpty(&m_rectPos))	{   //strange workaround for drawing zoom out smileys (look MS calculate it one pix larger than exactly)		if (rc.bottom-rc.top-1 == m_rectPos.bottom-m_rectPos.top 			&& rc.right-rc.left== m_rectPos.right-m_rectPos.left)			rc.top+=1;	}	if ( bCustom )SelectSmileyClipRgn(di.hdcDraw, rc, hOldRgn, hNewRgn, TRUE);	InflateRect(&rc,-1,0); //border offset to fix blinked cursor painting	if ( (m_dwFlags&REO_INVERTEDSELECT) == 0 || !bCustom || m_bTransparent)		DoDrawSmiley(di.hdcDraw, rc, rc.right-rc.left,rc.bottom-rc.top, m_nFrameSize.Width, m_nFrameSize.Height);	else	{		Bitmap bmp(rc.right-rc.left,rc.bottom-rc.top, PixelFormat32bppARGB);		Graphics g(&bmp);		COLORREF col=(COLORREF)(m_clrBackColor);		SolidBrush brush(Color(GetRValue(col),GetGValue(col),GetBValue(col)));		g.FillRectangle( &brush, 0 ,0, rc.right-rc.left, rc.bottom-rc.top);		HDC hdc=g.GetHDC();		RECT mrc={0};		mrc.right=rc.right-rc.left;		mrc.bottom=rc.bottom-rc.top;		DoDrawSmiley(hdc, mrc, mrc.right-mrc.left,mrc.bottom-mrc.top, m_nFrameSize.Width, m_nFrameSize.Height);		InvertRect(hdc, &mrc);		BitBlt(di.hdcDraw, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, hdc, 0, 0, SRCCOPY );		g.ReleaseHDC(hdc);       	}	if ((m_dwFlags&REO_SELECTED) == REO_SELECTED && bCustom)	{		//Draw frame around		HBRUSH oldBrush=(HBRUSH)SelectObject(di.hdcDraw, GetStockObject(NULL_BRUSH)); 		HPEN oldPen=(HPEN)SelectObject(di.hdcDraw, GetStockObject(BLACK_PEN));		::Rectangle(di.hdcDraw, rc.left, rc.top, rc.right, rc.bottom );		SelectObject(di.hdcDraw, oldBrush);		SelectObject(di.hdcDraw, oldPen);	}	AdvanceFrame();	if (!bCustom) 		m_bPaintValid=false;	ResetClip(di.hdcDraw, hOldRgn, hNewRgn);	return S_OK;}
开发者ID:hgl888,项目名称:TeamTalk,代码行数:63,


示例12: DisViewBox_OnPaint

LRESULT DisViewBox_OnPaint(HWND hwnd, disview_struct *win, WPARAM wParam, LPARAM lParam){    HDC          hdc;    PAINTSTRUCT  ps;    SIZE fontsize;    TCHAR text[100];    TCHAR txt[100];    RECT rect;    int lg;    int ht;    HDC mem_dc;    HBITMAP mem_bmp;    u32  nbligne;    GetClientRect(hwnd, &rect);    lg = rect.right - rect.left;    ht = rect.bottom - rect.top;    hdc = BeginPaint(hwnd, &ps);    mem_dc = CreateCompatibleDC(hdc);    mem_bmp = CreateCompatibleBitmap(hdc, lg, ht);    SelectObject(mem_dc, mem_bmp);    FillRect(mem_dc, &rect, (HBRUSH)GetStockObject(WHITE_BRUSH));    SelectObject(mem_dc, GetStockObject(SYSTEM_FIXED_FONT));    GetTextExtentPoint32(mem_dc, "0", 1, &fontsize);    nbligne = ht/fontsize.cy;    SetTextColor(mem_dc, RGB(0,0,0));    if((win->mode==1) || ((win->mode==0) && (win->cpu->CPSR.bits.T == 0)))    {        u32 i;        u32 adr;        if (win->autoup||win->autogo)            win->curr_ligne = (win->cpu->instruct_adr >> 2);        adr = win->curr_ligne*4;        for(i = 0; i < nbligne; ++i)        {            u32 ins = _MMU_read32(win->cpu->proc_ID, MMU_AT_DEBUG, adr);            des_arm_instructions_set[INDEX(ins)](adr, ins, txt);            sprintf(text, "%04X:%04X  %08X  %s", (int)(adr>>16), (int)(adr&0xFFFF), (int)ins, txt);            DrawText(mem_dc, text, -1, &rect, DT_TOP | DT_LEFT | DT_NOPREFIX);            rect.top+=fontsize.cy;            adr += 4;        }        if(((win->cpu->instruct_adr&0x0FFFFFFF) >= (win->curr_ligne<<2))&&((win->cpu->instruct_adr&0x0FFFFFFF) <= (win->curr_ligne+(nbligne<<2))))        {            HBRUSH brjaune = CreateSolidBrush(RGB(255, 255, 0));            SetBkColor(mem_dc, RGB(255, 255, 0));            rect.top = (((win->cpu->instruct_adr&0x0FFFFFFF)>>2) - win->curr_ligne)*fontsize.cy;            rect.bottom = rect.top + fontsize.cy;            FillRect(mem_dc, &rect, brjaune);            des_arm_instructions_set[INDEX(win->cpu->instruction)](win->cpu->instruct_adr, win->cpu->instruction, txt);            sprintf(text, "%04X:%04X  %08X  %s", (int)((win->cpu->instruct_adr&0x0FFFFFFF)>>16), (int)(win->cpu->instruct_adr&0xFFFF), (int)win->cpu->instruction, txt);            DrawText(mem_dc, text, -1, &rect, DT_TOP | DT_LEFT | DT_NOPREFIX);            DeleteObject(brjaune);        }
开发者ID:rafaelmessias,项目名称:desmume,代码行数:67,


示例13: sizeof

/*============================================ *  BasicWindow::registWC__() *  WNDCLASS登
C++ GetString函数代码示例
C++ GetStatus函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。