本文整理汇总了C++中ValidateRect函数的典型用法代码示例。如果您正苦于以下问题:C++ ValidateRect函数的具体用法?C++ ValidateRect怎么用?C++ ValidateRect使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ValidateRect函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetClientRect
void mxBitmapButton::redraw()
{
HWND wnd = (HWND)getHandle();
if ( !wnd )
return;
if ( !m_bmImage.valid )
return;
RECT rc;
GetClientRect( wnd, &rc );
HDC dc = GetDC( wnd );
DrawBitmapToDC( dc, 0, 0, w(), h(), m_bmImage );
ReleaseDC( wnd, dc );
ValidateRect( wnd, &rc );
}
示例2: WndProc
//消息处理函数
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_PAINT:
ValidateRect(hwnd, NULL);
break;
case WM_KEYDOWN:
if (wParam == VK_ESCAPE)
{
DestroyWindow(hwnd);//销毁窗体并发送一个WM_DESTROY消息
}
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, message, wParam, lParam);
}
}
示例3: drawGraph
void drawGraph(HWND hwnd, HDC hdc) {
HPEN oldPen = NULL;
POINT pt;
for(int i = 0; i < mChannels.size(); i++) {
Channel* c = &mChannels[i];
HPEN pen = CreatePen(PS_SOLID, 2, c->getColor());
if(i == 0) {
oldPen = (HPEN)SelectObject(hdc, pen);
} else {
SelectObject(hdc, pen);
}
for(int j = 1; j < c->getNumKeys(); j++) {
Key* k1 = c->getKey(j-1);
Key* k2 = c->getKey(j);
int x1 = toScreenX(k1->x);
int y1 = toScreenY(k1->y);
int x2 = toScreenX(k2->x);
int y2 = toScreenY(k2->y);
MoveToEx(hdc, x1, y1, &pt);
LineTo(hdc, x2, y2);
Rectangle(hdc, x1-3, y1-3, x1+3, y1+3);
Rectangle(hdc, x2-3, y2-3, x2+3, y2+3);
}
DeleteObject(pen);
}
SelectObject(hdc, oldPen);
RECT r;
GetClientRect(hwnd, &r);
ValidateRect(hwnd, &r);
}
示例4: WndProc
static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int res = 0;
switch (message)
{
case WM_PAINT:
{
if (s_buffer)
{
StretchDIBits(s_hdc, 0, 0, s_width, s_height, 0, 0, s_width, s_height, s_buffer,
&s_bitmapInfo, DIB_RGB_COLORS, SRCCOPY);
ValidateRect(hWnd, NULL);
}
break;
}
case WM_KEYDOWN:
{
if ((wParam&0xFF) == 27)
s_close = 1;
break;
}
case WM_CLOSE:
{
s_close = 1;
break;
}
default:
{
res = DefWindowProc(hWnd, message, wParam, lParam);
}
}
return res;
}
示例5: repaint
virtual void repaint()
{
if ( retry_count && !restore_objects() ) return;
lpdev->Clear( 0L, NULL, D3DCLEAR_TARGET, 0x000000ff, 1.0f, 0L );
HRESULT rv = lpdev->BeginScene();
if( SUCCEEDED( rv ) )
{
set_vertex( 0, 0, input_width, input_height, surface_width, surface_height, 0, 0, rcWindow.right, rcWindow.bottom );
lpdev->SetTexture( 0, lptex );
lpdev->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 2 );
lpdev->EndScene();
if ( lpdev->Present( NULL, NULL, NULL, NULL ) == D3DERR_DEVICELOST ) retry_count = 60;
}
else retry_count = 60;
ValidateRect( hWnd, & rcWindow );
}
示例6: WinMainProc
LRESULT CALLBACK WinMainProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
switch (msg)
{
case WM_PAINT: //客户区重绘
Direct3DRender();//渲染图形
ValidateRect(hWnd,NULL);//更新客户区显示
break;
case WM_DESTROY://窗口销毁消息
Direct3DCleanup();//清理Direct3D
PostQuitMessage(0);//退出
break;
case WM_KEYDOWN:
if (wParam==VK_ESCAPE)//ESC键
{
DestroyWindow(hWnd);//销毁窗口,并发送一条WM_DESTROY消息
}
break;
}
return DefWindowProc(hWnd,msg,wParam,lParam);
}
示例7: WndProc
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
{
switch (message)
{
case WM_CREATE:
PlaySound(L"FirstBlood.wav", nullptr, SND_FILENAME | SND_ASYNC);
break;
case WM_PAINT:
ValidateRect(hwnd, NULL);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, message, wparam, lparam);
}
return 0;
}
示例8: WndProc
LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch(Message){
case WM_CREATE:
break;
case WM_SIZE:
/* This is called with 0,0 when iconized. That is bad. So don't resize
now.*/
wWidth = LOWORD(lParam); // width of client area
wHeight = HIWORD(lParam); // height of client area
/* printf("Resized: %d %d\n",wWidth,wHeight); */
/* AccisRenewBitmap(hwnd);*/
break;
case WM_PAINT:
/* printf("Paint BitBlt\n"); */
/*Trying for private DC*/
/* hdcWindow = BeginPaint(hwnd, &ps); */
BitBlt(hdcWindow, 0, 0, wWidth, wHeight, hdcMemory, 0, 0, SRCCOPY);
/* EndPaint(hwnd, &ps); */
GetClientRect(hwnd,&wRect);
ValidateRect(hwnd,&wRect);/* Needed without endpaint. Not perfect.
Resize leads to continuous BitBlt.
Needs new/current window size.*/
break;
case WM_CLOSE:
/* It is not safe to do the following from the right-hand X.
Makes the program hang. The Default is also bad so act the same.*/
/* DestroyWindow(hwnd); */
/* break; */
case WM_DESTROY:
case WM_LBUTTONDOWN: /* Click in window to exit from this message loop. */
DeleteDC(hdcMemory);
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, Message, wParam, lParam);
}
return 0;
}
示例9: WndProc
LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_CREATE:
{
if (FAILED(InitD3D(hWnd)))
{
MessageBox(hWnd, TEXT("Initialize DirectX failed"), TEXT("警告"), MB_OK | MB_ICONERROR);
PostQuitMessage(0);
}
break;
}
case WM_PAINT:
Render(hWnd);
ValidateRect(hWnd, NULL);
break;
case WM_KEYDOWN:
if (wParam == VK_ESCAPE)
{
DestroyWindow(hWnd);
}
else
{
ChangeObject();
}
break;
case WM_SIZE:
OnSize((short)LOWORD(lParam), (short)HIWORD(lParam));
break;
case WM_DESTROY:
Cleanup();
PostQuitMessage(0);
break;
default:
return ::DefWindowProc(hWnd, uMsg, wParam, lParam);
}
return 0;
}
示例10: dbwWindowProc
/*-----------------------------------------------------------------------------
Name : dbwWindowProc
Description : Window Procedure for debug window
Inputs : see Windows docs
Outputs : " " "
Return : " " "
----------------------------------------------------------------------------*/
long FAR PASCAL dbwWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
{
RECT rect;
switch (message)
{
case WM_SETFOCUS:
SetFocus(ghMainWindow);
break;
case WM_MOVE:
GetWindowRect(hWnd, &rect);
dbwWindowX = rect.left;
dbwWindowY = rect.top;
return 0;
case WM_PAINT:
dbwAllPanesRepaint((HDC)wParam);
ValidateRect(hDebugWindow, NULL);
return 0;
case WM_DESTROY:
return 0;
}
return DefWindowProc(hWnd, message, wParam, lParam);
}
示例11: GetDC
/***************************************************
OnPaint
The framework calls this member function when Windows
or an application makes a request to repaint a portion
of an application’s window.
The CUGHint uses this event to draw the tool tip
window.
Params:
<none>
Returns:
<none>
*****************************************************/
void CUGHint::OnPaint()
{
if ( m_ctrl->m_GI->m_paintMode == FALSE )
return;
CDC* dc = GetDC();
if(m_hFont != NULL)
dc->SelectObject(m_hFont);
CRect rect;
GetClientRect(rect);
dc->SetTextColor(m_textColor);
dc->SetBkColor(m_backColor);
dc->SetBkMode(OPAQUE);
dc->DrawText(m_text,&rect,DT_CENTER|DT_VCENTER|DT_SINGLELINE);
ReleaseDC(dc);
ValidateRect(NULL);
}
示例12: PopupWndProc
LONG WINAPI PopupWndProc(HWND hWnd,UINT messg,UINT wParam,LONG lParam)
{
int idPopup;
HDC hdc;
PAINTSTRUCT ps;
static int xClientView,yClientView;
static HWND hInst;
static FARPROC fpfnAboutDiaProc;
idPopup = GetWindowLong(hWnd, GWL_ID);
switch (messg)
{
case WM_CREATE:
hdc =GetDC(hWnd);
GetTextMetrics(hdc, &tm);
ReleaseDC(hWnd,hdc);
wins[idPopup]->dwCharX = tm.tmAveCharWidth;
wins[idPopup]->dwCharY = tm.tmHeight;
return 0;
case WM_PAINT:
hdc=BeginPaint(hWnd,&ps);
ValidateRect(hWnd,0);
EndPaint(hWnd,&ps);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_VSCROLL:
case WM_HSCROLL:
default:
return(DefWindowProc(hWnd,messg,wParam,lParam));
}
return(0L);
}
示例13: SelectClipRgn
//-----------------------------------------------------------------------------
// Purpose: Finish up
//-----------------------------------------------------------------------------
CDrawHelper::~CDrawHelper( void )
{
SelectClipRgn( m_dcMemory, NULL );
while ( m_ClipRects.Size() > 0 )
{
StopClipping();
}
BitBlt( m_dcReal, m_x, m_y, m_w, m_h, m_dcMemory, 0, 0, SRCCOPY );
SetBkColor( m_dcMemory, m_clrOld );
SelectObject( m_dcMemory, m_bmOld );
DeleteObject( m_bmMemory );
DeleteObject( m_dcMemory );
ReleaseDC( m_hWnd, m_dcReal );
ValidateRect( m_hWnd, &m_rcClient );
}
示例14: switch
/**
* Windows message process procedure
*/
LRESULT CALLBACK Application::winProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch( msg )
{
case WM_CLOSE:
PostQuitMessage( 0 );
return 0;
case WM_ACTIVATE:
isActive = HIWORD( wParam ) ? false : true;
return 0;
case WM_SYSCOMMAND:
/* TODO (#1#): add here alt+tab or alt+enter */
if (wParam == SC_SCREENSAVE || wParam == SC_MONITORPOWER)
return 0;
else
break;
case WM_PAINT:
ValidateRect( hWnd, NULL );
return 0;
case WM_SIZE:
Renderer::instance().resize( (int)LOWORD(lParam), (int)HIWORD(lParam) );
return 0;
case WM_KEYDOWN:
keys[wParam] = true;
return 0;
case WM_KEYUP:
keys[wParam] = false;
return 0;
}
return DefWindowProc( hWnd, msg, wParam, lParam );
}
示例15: switch
LRESULT Win32DDFullScreen::wndProc( HWND hwnd,UINT msg,WPARAM wp,LPARAM lp,WNDPROC proc ){
switch( msg ){
case WM_PAINT:
if( _excl!=this ){
}else if( IsIconic(_hwnd.hwnd()) ){
}else if( !primarySurface() ){
//restore primary surface
if( !_graphics->restore() ){
//Argh! Don't work if an 'owned' window is active!!!!!
break;
}
//create clipper
if( _flags & BBScreen::SCREEN_GUICOMPATIBLE ){
if( _clipper ){ _clipper->Release();_clipper=0; }
if( win32DD.directDraw()->CreateClipper(0,&_clipper,0)<0 ){
bbError( "Failed to create DD clipper" );
}
_clipper->SetHWnd( 0,_hwnd.hwnd() );
}
//fix gamma
// updateGamma( false );
}else if( _flags & BBScreen::SCREEN_GUICOMPATIBLE ){
flip(false);
}
ValidateRect(hwnd,0);
return 0;
case WM_ERASEBKGND:
return 1;
}
return Win32DDScreen::wndProc( hwnd,msg,wp,lp,proc );
}