这篇教程C++ CopyRect函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CopyRect函数的典型用法代码示例。如果您正苦于以下问题:C++ CopyRect函数的具体用法?C++ CopyRect怎么用?C++ CopyRect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CopyRect函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: xxxCalcClientRectvoid xxxCalcClientRect( PWND pwnd, LPRECT lprc, BOOL fHungRedraw){ int cxFrame, yTopOld; RECT rcTemp; PMENU pMenu; TL tlpmenu; int cBorders; BOOL fEmptyClient; CheckLock(pwnd); /* * Clear all the frame bits. NOTE: The HIBYTE of all these #defines * must stay the same for this line to work. */ ClrWF(pwnd, (WFHPRESENT | WFVPRESENT | WFCPRESENT | WFMPRESENT)); // // We need to clear the client border bits also. Otherwise, when the // window gets really small, the client border will draw over the menu // and caption. // ClrWF(pwnd, WFCEPRESENT); /* * If the window is iconic, the client area is empty. */ if (TestWF(pwnd, WFMINIMIZED)) { // SetRectEmpty(lprc); // We must make it an empty rectangle. // But, that empty rectangle should be at the top left corner of the // window rect. Else, ScreenToClient() will return bad values. lprc->right = lprc->left; lprc->bottom = lprc->top; return; } // Save rect into rcTemp for easy local calculations. CopyRect(&rcTemp, lprc); // Save the top so we'll know how tall the caption was yTopOld = rcTemp.top; // Adjustment for the caption if (TestWF(pwnd, WFBORDERMASK) == LOBYTE(WFCAPTION)) { SetWF(pwnd, WFCPRESENT); rcTemp.top += TestWF(pwnd, WEFTOOLWINDOW) ? SYSMET(CYSMCAPTION) : SYSMET(CYCAPTION); } // Subtract out window borders cBorders = GetWindowBorders(pwnd->style, pwnd->ExStyle, TRUE, FALSE); cxFrame = cBorders * SYSMET(CXBORDER); InflateRect(&rcTemp, -cxFrame, -cBorders*SYSMET(CYBORDER)); if (!TestwndChild(pwnd) && (pMenu = pwnd->spmenu)) { SetWF(pwnd, WFMPRESENT); if (!fHungRedraw) { ThreadLockAlways(pMenu, &tlpmenu); rcTemp.top += xxxMenuBarCompute(pMenu, pwnd, rcTemp.top - yTopOld, cxFrame, rcTemp.right - rcTemp.left); ThreadUnlock(&tlpmenu); } } // // Fix for B#1425 -- Sizing window really small used to move children's // rects because the client calculations were wrong. So we make the // bottom of the client match up with the top (the bottom of the menu // bar). // fEmptyClient = FALSE; if (rcTemp.top >= rcTemp.bottom) { rcTemp.bottom = rcTemp.top; fEmptyClient = TRUE; } // // BOGUS BOGUS BOGUS // Hack for Central Point PC Tools. // Possibly for M5 only. // B#8445 // // They check for div-by-zero all over, but they jump to the wrong place // if a zero divisor is encountered, and end up faulting anyway. So this // code path was never tested basically. There's a period when starting // up where the window rect of their drives ribbon is empty. In Win3.x, // the client would be shrunk to account for the border it had, and it // would look like it wasn't empty because the width would be negative, // signed! So we version-switch this code, since other apps have // reported the non-emptiness as an annoying bug. // if (TestWF(pwnd, WFWIN40COMPAT) && (rcTemp.left >= rcTemp.right)) { rcTemp.right = rcTemp.left; fEmptyClient = TRUE;//.........这里部分代码省略.........
开发者ID:Gaikokujin,项目名称:WinNT4,代码行数:101,
示例2: MSWDrawXPBackgroundstaticvoid MSWDrawXPBackground(wxButton *button, WXDRAWITEMSTRUCT *wxdis){ LPDRAWITEMSTRUCT lpDIS = (LPDRAWITEMSTRUCT)wxdis; HDC hdc = lpDIS->hDC; UINT state = lpDIS->itemState; RECT rectBtn; CopyRect(&rectBtn, &lpDIS->rcItem); wxUxThemeHandle theme(button, L"BUTTON"); int iState; if ( state & ODS_SELECTED ) { iState = PBS_PRESSED; } else if ( button->HasCapture() || button->IsMouseInWindow() ) { iState = PBS_HOT; } else if ( state & ODS_FOCUS ) { iState = PBS_DEFAULTED; } else if ( state & ODS_DISABLED ) { iState = PBS_DISABLED; } else { iState = PBS_NORMAL; } // draw parent background if needed if ( wxUxThemeEngine::Get()->IsThemeBackgroundPartiallyTransparent(theme, BP_PUSHBUTTON, iState) ) { wxUxThemeEngine::Get()->DrawThemeParentBackground(GetHwndOf(button), hdc, &rectBtn); } // draw background wxUxThemeEngine::Get()->DrawThemeBackground(theme, hdc, BP_PUSHBUTTON, iState, &rectBtn, NULL); // calculate content area margins MARGINS margins; wxUxThemeEngine::Get()->GetThemeMargins(theme, hdc, BP_PUSHBUTTON, iState, TMT_CONTENTMARGINS, &rectBtn, &margins); RECT rectClient; ::CopyRect(&rectClient, &rectBtn); ::InflateRect(&rectClient, -margins.cxLeftWidth, -margins.cyTopHeight); // if focused and !nofocus rect if ( (state & ODS_FOCUS) && !(state & ODS_NOFOCUSRECT) ) { DrawFocusRect(hdc, &rectClient); } if ( button->UseBgCol() ) { COLORREF colBg = wxColourToRGB(button->GetBackgroundColour()); HBRUSH hbrushBackground = ::CreateSolidBrush(colBg); // don't overwrite the focus rect ::InflateRect(&rectClient, -1, -1); FillRect(hdc, &rectClient, hbrushBackground); ::DeleteObject(hbrushBackground); }}
开发者ID:EdgarTx,项目名称:wx,代码行数:70,
示例3: CheckBox_Paint//----CheckBox绘制函数----------------------------------------------------------//功能:这是CheckBox控件的MSG_PAINT消息响应函数//参数:pMsg,消息指针//返回:固定true//-----------------------------------------------------------------------------static bool_t CheckBox_Paint(struct WindowMsg *pMsg){ HWND hwnd; HDC hdc; RECT rc; RECT rc0; hwnd=pMsg->hwnd; hdc =BeginPaint(hwnd); if(NULL!=hdc) { GetClientRect(hwnd,&rc0); SetTextColor(hdc,RGB(1,1,1)); SetDrawColor(hdc,RGB(40,40,40)); SetFillColor(hdc,RGB(200,200,200)); FillRect(hdc,&rc0); if(hwnd->Style&CBS_SELECTED) { CopyRect(&rc,&rc0); rc.right =rc.left+RectH(&rc0); InflateRect(&rc,-2,-2); SetDrawColor(hdc,RGB(70,70,70)); DrawRect(hdc,&rc); InflateRect(&rc,-1,-1); SetDrawColor(hdc,RGB(110,110,110)); DrawRect(hdc,&rc); InflateRect(&rc,-1,-1); SetFillColor(hdc,RGB(240,240,240)); FillRect(hdc,&rc); InflateRect(&rc,-4,-4); SetDrawColor(hdc,RGB(150,150,240)); DrawRect(hdc,&rc); InflateRect(&rc,-1,-1); SetDrawColor(hdc,RGB(100,100,220)); DrawRect(hdc,&rc); InflateRect(&rc,-1,-1); SetFillColor(hdc,RGB(50,50,200)); FillRect(hdc,&rc); } else { CopyRect(&rc,&rc0); rc.right =rc.left+RectH(&rc0); InflateRect(&rc,-2,-2); SetDrawColor(hdc,RGB(100,100,100)); DrawRect(hdc,&rc); InflateRect(&rc,-1,-1); SetDrawColor(hdc,RGB(160,160,160)); DrawRect(hdc,&rc); InflateRect(&rc,-1,-1); SetFillColor(hdc,RGB(220,220,220)); FillRect(hdc,&rc); } CopyRect(&rc,&rc0); InflateRectEx(&rc,-RectH(&rc),0,0,0); DrawText(hdc,hwnd->Text,-1,&rc,DT_LEFT|DT_VCENTER); EndPaint(hwnd,hdc); } return true;}
开发者ID:djyos,项目名称:djyos,代码行数:81,
示例4: winInitDialogstatic voidwinInitDialog (HWND hwndDlg){ HWND hwndDesk; RECT rc, rcDlg, rcDesk; HICON hIcon, hIconSmall; hwndDesk = GetParent (hwndDlg); if (!hwndDesk || IsIconic (hwndDesk)) hwndDesk = GetDesktopWindow (); /* Remove minimize and maximize buttons */ SetWindowLongPtr(hwndDlg, GWL_STYLE, GetWindowLongPtr(hwndDlg, GWL_STYLE) & ~(WS_MAXIMIZEBOX | WS_MINIMIZEBOX)); /* Set Window not to show in the task bar */ SetWindowLongPtr(hwndDlg, GWL_EXSTYLE, GetWindowLongPtr(hwndDlg, GWL_EXSTYLE) & ~WS_EX_APPWINDOW ); /* Center dialog window in the screen. Not done for multi-monitor systems, where * it is likely to end up split across the screens. In that case, it appears * near the Tray icon. */ if (GetSystemMetrics(SM_CMONITORS)>1) { /* Still need to refresh the frame change. */ SetWindowPos (hwndDlg, HWND_TOPMOST, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); } else { GetWindowRect (hwndDesk, &rcDesk); GetWindowRect (hwndDlg, &rcDlg); CopyRect (&rc, &rcDesk); OffsetRect (&rcDlg, -rcDlg.left, -rcDlg.top); OffsetRect (&rc, -rc.left, -rc.top); OffsetRect (&rc, -rcDlg.right, -rcDlg.bottom); SetWindowPos (hwndDlg, HWND_TOPMOST, rcDesk.left + (rc.right / 2), rcDesk.top + (rc.bottom / 2), 0, 0, SWP_NOSIZE | SWP_FRAMECHANGED); }#ifdef XWIN_MULTIWINDOW if (g_hIconX) hIcon=g_hIconX; else#endif hIcon = LoadIcon (g_hInstance, MAKEINTRESOURCE(IDI_XWIN));#ifdef XWIN_MULTIWINDOW if (g_hSmallIconX) hIconSmall=g_hSmallIconX; else#endif hIconSmall = LoadImage (g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED); PostMessage (hwndDlg, WM_SETICON, ICON_BIG, (LPARAM) hIcon); PostMessage (hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM) hIconSmall);}
开发者ID:4eremuxa,项目名称:xserver,代码行数:64,
示例5: glClearvoid CMemoryCardView::CRender::DrawScene(){ RECT ClientRect; glClear(GL_COLOR_BUFFER_BIT); if(m_memoryCard == NULL) return; unsigned int nItemCount = static_cast<unsigned int>(m_memoryCard->GetSaveCount()); CopyRect(&ClientRect, &m_viewState->m_ClientRect); int nY = 0; int nUpperClip = (int)(m_viewState->m_nScrollPosition - m_viewState->m_nItemHeight); int nLowerClip = nUpperClip + ClientRect.bottom + m_viewState->m_nItemHeight; for(unsigned int i = 0; i < nItemCount; i++) { if(nY >= nLowerClip) break; if(nY > nUpperClip) { glClear(GL_DEPTH_BUFFER_BIT); glViewport(0, (ClientRect.bottom - nY - m_viewState->m_nItemHeight + m_viewState->m_nScrollPosition), m_viewState->m_nItemWidth, m_viewState->m_nItemHeight); if(nY == (m_viewState->m_nSelection * m_viewState->m_nItemHeight)) { glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0, 1, 1, 0, 0, 1); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glDisable(GL_DEPTH_TEST); glColor4f(0.0f, 0.0f, 0.0f, 1.0f); glBegin(GL_QUADS); { glVertex2f(0.0, 0.0); glVertex2f(1.0, 0.0); glVertex2f(1.0, 1.0); glVertex2f(0.0, 1.0); } glEnd(); } glEnable(GL_DEPTH_TEST); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0.0f, -2.0f, -7.0f); glScalef(1.0f, -1.0f, -1.0f); glColor4f(1.0f, 1.0f, 1.0f, 1.0f); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0f, (float)m_viewState->m_nItemWidth / (float)m_viewState->m_nItemHeight, 0.1f, 100.0f); IconMeshPtr iconMesh; IconList::iterator itIcon = m_icons.find(i); if(itIcon == m_icons.end()) { const CSave* pSave = m_memoryCard->GetSaveByIndex(i); try { auto iconStream(Framework::CreateInputStdStream(pSave->GetNormalIconPath().native())); IconPtr iconData(new CIcon(iconStream)); iconMesh = IconMeshPtr(new CIconMesh(iconData)); } catch(...) { } m_icons[i] = iconMesh; } else { iconMesh = itIcon->second; } if(iconMesh) { iconMesh->Render(); } } nY += m_viewState->m_nItemHeight; } SwapBuffers(m_deviceContext);}
开发者ID:250394,项目名称:Play-,代码行数:98,
示例6: printer//.........这里部分代码省略......... if(cellrect.top == cellrect.bottom) continue; //main column drawing loop xx =startCol; if(m_printSideHeading) xx = 0 - m_GI->m_numberSideHdgCols; for(x = xx; x <= endCol; x++) { if( x < 0 ) { //get the side heading co-ords cellrect.left = cellrect.right; cellrect.right += (int)(m_ctrl->m_CUGSideHdg->GetSHColWidth(x) * m_printHScale); } else { if(xx < 0) { xx=0; x = startCol; } //get the left,right co-ords cellrect.left = cellrect.right; m_ctrl->GetColWidth(x,&w); cellrect.right += (int)(w * m_printHScale); } //dont draw the column if it is 0 pixels wide if(cellrect.left == cellrect.right) continue; //store the original cell rect, incase it is modified below CopyRect(&origCellRect,&cellrect); col = x; row = y; //check to see if the cell is a joined cell if(m_ctrl->GetJoinStartCell(&col,&row)==UG_SUCCESS) { RECT tempRect; CUGCell sourceCell, targetCell; int col2, tempCol, tempCol2; long row2, tempRow, tempRow2; tempCol = col; tempRow = row; m_ctrl->GetJoinRange(&col,&row,&col2,&row2); tempCol2 = col2; tempRow2 = row2; if ((y == startRow && x == col) || (x == startCol && y == row) || (y == startRow && x == startCol)) { m_ctrl->GetCell (col,row,&sourceCell); m_ctrl->SetCell (x,y,&sourceCell); m_ctrl->JoinCells (x,y,col2,row2); col = x; row = y; m_ctrl->GetJoinRange(&col,&row,&col2,&row2); } if(col == x && row == y) { CopyRect(&tempRect,&cellrect);
开发者ID:acraig5075,项目名称:best-fit-demo,代码行数:67,
示例7: ShowNotifyWndvoid ShowNotifyWnd(HWND hWnd, LPCTSTR title, LPCTSTR content, int timeoutMS, int nIcon, int nImg){ //EnterCriticalSection(&g_NotifyInfo.cs); //g_NotifyInfo.mode = mode; LPNOTIFYWND_DATA pInfo = (LPNOTIFYWND_DATA)GetWindowLongPtr(hWnd, GWLP_USERDATA); if(pInfo == NULL) return; _tcscpy_s(pInfo->szTitle, _ARRAYSIZE(pInfo->szTitle), title); _tcscpy_s(pInfo->szContent, _ARRAYSIZE(pInfo->szContent), content); if(nIcon >= 0) pInfo->rcTitle.left = pInfo->rcIcon.right + g_NotifyInfo.gap; else pInfo->rcTitle.left = 3 + g_NotifyInfo.gap; if(nImg >= 0) pInfo->rcContent.left = pInfo->rcImg.right + g_NotifyInfo.gap; else pInfo->rcContent.left = pInfo->rcContentOutter.left + g_NotifyInfo.gap; pInfo->rcContent.top = pInfo->rcContentOutter.top + g_NotifyInfo.gap; pInfo->rcContent.right = pInfo->rcContent.left + pInfo->contentWidth; pInfo->rcContentOutter.right = pInfo->rcContent.right + g_NotifyInfo.gap; pInfo->wndWidth = pInfo->rcContentOutter.right + 3; pInfo->rcTitle.right = pInfo->wndWidth - g_NotifyInfo.gap; pInfo->rcContent.bottom = pInfo->rcContent.top + 48; pInfo->rcContentOutter.bottom = pInfo->rcContent.bottom + g_NotifyInfo.gap; //rcCloseBtn pInfo->rcCloseBtn.right = pInfo->wndWidth - 3 - g_NotifyInfo.gap/2; pInfo->rcCloseBtn.left = pInfo->rcCloseBtn.right - g_NotifyInfo.closeBtnSize; pInfo->rcCloseBtn.top = (pInfo->rcTitle.top + pInfo->rcTitle.bottom - g_NotifyInfo.closeBtnSize)/2; pInfo->rcCloseBtn.bottom = pInfo->rcCloseBtn.top + g_NotifyInfo.closeBtnSize; SetBkMode(pInfo->hMemDC, TRANSPARENT); //DT_TOP = 0; (default) 在这里测量矩形 HGDIOBJ hOldFont = SelectObject(pInfo->hMemDC, g_NotifyInfo.hFontContent); DrawText(pInfo->hMemDC, pInfo->szContent, -1, &pInfo->rcContent, DT_LEFT | DT_WORDBREAK | DT_CALCRECT); //复原宽度 pInfo->rcContent.right = pInfo->rcContent.left + pInfo->contentWidth; if(pInfo->mode == MODE_PROGRESS) { pInfo->bDownloading = TRUE; pInfo->rcProgressText.left = pInfo->rcContent.left; pInfo->rcProgressText.top = pInfo->rcContent.bottom + g_NotifyInfo.gap; pInfo->rcProgressText.right = pInfo->rcContent.right; pInfo->rcProgressText.bottom = pInfo->rcProgressText.top + pInfo->titleHeight; pInfo->rcProgressBarOutter.left = pInfo->rcContent.left; pInfo->rcProgressBarOutter.top = pInfo->rcProgressText.bottom + g_NotifyInfo.gap; pInfo->rcProgressBarOutter.right = pInfo->rcContent.right; pInfo->rcProgressBarOutter.bottom = pInfo->rcProgressBarOutter.top + g_NotifyInfo.gap * 2 + 4; CopyRect(&pInfo->rcProgressBar, &pInfo->rcProgressBarOutter); InflateRect(&pInfo->rcProgressBar, -2, - 2); pInfo->rcContent.bottom = pInfo->rcProgressBar.bottom + g_NotifyInfo.gap; } //更新高度等 if(nImg >= 0 && pInfo->rcImg.bottom > pInfo->rcContent.bottom) pInfo->rcContentOutter.bottom = pInfo->rcImg.bottom + g_NotifyInfo.gap; else pInfo->rcContentOutter.bottom = pInfo->rcContent.bottom + g_NotifyInfo.gap; pInfo->wndHeight = pInfo->rcContentOutter.bottom + 3; //FillRgn(hdc, pInfo->hRgnBkGnd, pInfo->hBrush); RECT rc = { 0, 0, pInfo->wndWidth, pInfo->wndHeight }; FillRect(pInfo->hMemDC, &rc, GetSysColorBrush(COLOR_INACTIVECAPTION)); //pInfo->hBrush); FrameRect(pInfo->hMemDC, &rc, g_NotifyInfo.hBrushBorder); FillRect(pInfo->hMemDC, &pInfo->rcContentOutter, (HBRUSH)GetStockObject(WHITE_BRUSH)); //绘制标题icon if(nIcon >= 0 && !g_NotifyInfo.pIcons->IsNull()) { g_NotifyInfo.pIcons->AlphaBlend(pInfo->hMemDC, pInfo->rcIcon.left, pInfo->rcIcon.top, g_NotifyInfo.iconSize, g_NotifyInfo.iconSize, g_NotifyInfo.iconSize * nIcon, 0, g_NotifyInfo.iconSize, g_NotifyInfo.iconSize); } //绘制左上角Image if(nImg >= 0 && !g_NotifyInfo.pImgs->IsNull()) { g_NotifyInfo.pImgs->AlphaBlend(pInfo->hMemDC, pInfo->rcImg.left, pInfo->rcImg.top, g_NotifyInfo.imgSize, g_NotifyInfo.imgSize, g_NotifyInfo.imgSize * nImg, 0, g_NotifyInfo.imgSize, g_NotifyInfo.imgSize); } //绘制标题//.........这里部分代码省略.........
开发者ID:zcp0415,项目名称:CloudDesktop,代码行数:101,
示例8: VideoRenderer_SetTargetRectstatic HRESULT WINAPI VideoRenderer_SetTargetRect(BaseControlVideo* iface, RECT *pTargetRect){ VideoRendererImpl *This = impl_from_BaseControlVideo(iface); CopyRect(&This->DestRect,pTargetRect); return S_OK;}
开发者ID:hoangduit,项目名称:reactos,代码行数:6,
示例9: khm_toolbar_notify//.........这里部分代码省略......... khm_statusbar_set_part(KHUI_SBPART_INFO, NULL, buf); } } break; case TBN_DROPDOWN: { LPNMTOOLBAR nmtb = (LPNMTOOLBAR) notice; RECT r; GetWindowRect(khui_hwnd_standard_toolbar, &r); if (nmtb->iItem == KHUI_ACTION_DESTROY_CRED) { khm_menu_show_panel(KHUI_MENU_DESTROY_CRED, r.left + nmtb->rcButton.left, r.top + nmtb->rcButton.bottom); } else if (nmtb->iItem == KHUI_ACTION_RENEW_CRED) { khm_menu_show_panel(KHUI_MENU_RENEW_CRED, r.left + nmtb->rcButton.left, r.top + nmtb->rcButton.bottom); } else { return TBDDRET_NODEFAULT; } return TBDDRET_DEFAULT; } break; case NM_CUSTOMDRAW: { LPNMTBCUSTOMDRAW nmcd = (LPNMTBCUSTOMDRAW) notice; if(nmcd->nmcd.dwDrawStage == CDDS_PREPAINT) { return CDRF_NOTIFYITEMDRAW | CDRF_NOTIFYPOSTERASE; } else if(nmcd->nmcd.dwDrawStage == CDDS_ITEMPREPAINT) { return CDRF_NOTIFYPOSTPAINT; } else if(nmcd->nmcd.dwDrawStage == CDDS_ITEMPOSTPAINT) { /* draw the actual icon */ int iidx; int ibmp; HBITMAP hbmp; RECT r; khui_action * act = khui_find_action((int) nmcd->nmcd.dwItemSpec); if(!act || !act->ib_normal) return CDRF_DODEFAULT; if((act->state & KHUI_ACTIONSTATE_DISABLED) && act->ib_disabled) { ibmp = act->ib_disabled; } else if(act->ib_hot && ((nmcd->nmcd.uItemState & CDIS_HOT) || (nmcd->nmcd.uItemState & CDIS_SELECTED))){ ibmp = act->ib_hot; } else { ibmp = act->ib_normal; } iidx = khui_ilist_lookup_id(ilist_toolbar, ibmp); if(iidx < 0) { hbmp = LoadImage(khm_hInstance, MAKEINTRESOURCE(ibmp), IMAGE_BITMAP, KHUI_TOOLBAR_IMAGE_WIDTH, KHUI_TOOLBAR_IMAGE_HEIGHT, 0); iidx = khui_ilist_add_masked_id(ilist_toolbar, hbmp, KHUI_TOOLBAR_BGCOLOR, ibmp); DeleteObject(hbmp); } if(iidx < 0) return CDRF_DODEFAULT; CopyRect(&r, &(nmcd->nmcd.rc)); r.left += ((r.bottom - r.top) - KHUI_TOOLBAR_IMAGE_HEIGHT) / 2; r.top += ((r.bottom - r.top) - KHUI_TOOLBAR_IMAGE_HEIGHT) / 2;#if 0 r.left += ((r.right - r.left) - KHUI_TOOLBAR_IMAGE_WIDTH) / 2;#endif khui_ilist_draw(ilist_toolbar, iidx, nmcd->nmcd.hdc, r.left, r.top, 0); return CDRF_DODEFAULT; } } break; } return 0;}
开发者ID:FarazShaikh,项目名称:LikewiseSMB2,代码行数:101,
示例10: GetScreenSelectionbool GetScreenSelection(HINSTANCE hInstance, RECT *rcSelection, HWND target){ char* szClassName = "SelectionClass"; DWORD style = WS_POPUP | WS_EX_TOPMOST;// | WS_VISIBLE; DWORD styleEx = WS_EX_TOOLWINDOW; WNDCLASSEX wcex = { 0 }; wcex.cbSize = sizeof(WNDCLASSEX); wcex.hInstance = hInstance; wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); wcex.hCursor = LoadCursor(NULL, IDC_CROSS); wcex.lpfnWndProc = SelectionProc; wcex.lpszClassName = szClassName; SelectionState state = { 0 }; state.Result = FALSE; HDC hDeviceContext = GetDC(target); if (!GetClientRect(target, &state.Window.Rect)) { goto cleanup; } state.Window.hBitmap = CreateCompatibleBitmap(hDeviceContext, state.Window.Rect.right, state.Window.Rect.bottom); if (!state.Window.hBitmap) goto cleanup; state.Window.hDeviceContext = CreateCompatibleDC(hDeviceContext); if (!state.Window.hDeviceContext) goto cleanup; state.Selection.hBitmap = CreateCompatibleBitmap(hDeviceContext, state.Window.Rect.right, state.Window.Rect.bottom); if (!state.Selection.hBitmap) goto cleanup; state.Selection.hDeviceContext = CreateCompatibleDC(hDeviceContext); if (!state.Selection.hDeviceContext) goto cleanup; SelectObject(state.Window.hDeviceContext, state.Window.hBitmap); SelectObject(state.Selection.hDeviceContext, state.Selection.hBitmap); BitBlt(state.Window.hDeviceContext, 0, 0, state.Window.Rect.right, state.Window.Rect.bottom, hDeviceContext, state.Window.Rect.left, state.Window.Rect.top, SRCCOPY); ReleaseDC(NULL, hDeviceContext); hDeviceContext = NULL; HWND hWndSelect = Win32CreateWindow(hInstance, wcex, styleEx, style, "Selection Window", state.Window.Rect.right, state.Window.Rect.bottom, state.Window.Rect.left, state.Window.Rect.top, HWND_DESKTOP, &state); if (!hWndSelect) { goto cleanup; } SetForegroundWindow(target); SetForegroundWindow(hWndSelect); ShowWindow(hWndSelect, SW_SHOW); UpdateWindow(hWndSelect); MSG msg; state.Wait = TRUE; while (state.Wait) { if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); } else { PostQuitMessage(msg.wParam); } } if (state.Result) { CopyRect(rcSelection, &state.Selection.Rect); }cleanup: if (hDeviceContext) ReleaseDC(NULL, hDeviceContext); CleanUp(state.Window); CleanUp(state.Selection); return state.Result;};
开发者ID:mindfog,项目名称:Dota2-TreeCut,代码行数:92,
示例11: VideoRenderer_GetSourceRectstatic HRESULT WINAPI VideoRenderer_GetSourceRect(BaseControlVideo* iface, RECT *pSourceRect){ VideoRendererImpl *This = impl_from_BaseControlVideo(iface); CopyRect(pSourceRect,&This->SourceRect); return S_OK;}
开发者ID:hoangduit,项目名称:reactos,代码行数:6,
示例12: rectTempCSDWindow::CSDWindow(POINT point, SIZE size){ CRect rectTemp(point, size); CopyRect(rectTemp);}
开发者ID:jogunhee,项目名称:ScreenDivider,代码行数:6,
示例13: ConfigDlgProc//// Dialogbox procedure for Configuration window//BOOL CALLBACK ConfigDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam){ static char buf[256]; HWND hwndCombo, hwndCtrl; int index, items, val; RECT rect; static int prevwidth, prevheight; switch(uMsg) { case WM_INITDIALOG: prevwidth = GetSystemMetrics(SM_CXSCREEN) / GLYPH_WIDTH; prevheight = GetSystemMetrics(SM_CYSCREEN) / GLYPH_HEIGHT + 1; //Add any saved messages to the combo box for(index = 0; index < g_nNumMessages; index++) { if(lstrlen(g_szMessages[index]) > 0) SendDlgItemMessage(hwnd, IDC_COMBO1, CB_ADDSTRING, 0, (LPARAM)g_szMessages[index]); } //select the first message, and preview it SendDlgItemMessage(hwnd, IDC_COMBO1, CB_SETCURSEL, 0, 0); SendDlgItemMessage(hwnd, IDC_SLIDER1, TBM_SETRANGE, 0, MAKELONG(SPEED_MIN, SPEED_MAX)); SendDlgItemMessage(hwnd, IDC_SLIDER2, TBM_SETRANGE, 0, MAKELONG(DENSITY_MIN, DENSITY_MAX)); SendDlgItemMessage(hwnd, IDC_SLIDER3, TBM_SETRANGE, 0, MAKELONG(MSGSPEED_MIN, MSGSPEED_MAX)); SendDlgItemMessage(hwnd, IDC_SLIDER4, TBM_SETRANGE, 0, MAKELONG(FONT_MIN, FONT_MAX)); //SendDlgItemMessage(hwnd, IDC_SLIDER1, TBM_SETTICFREQ, 5, 0); SendDlgItemMessage(hwnd, IDC_SLIDER2, TBM_SETTICFREQ, 5, 0); SendDlgItemMessage(hwnd, IDC_SLIDER3, TBM_SETTICFREQ, 50, 0); SendDlgItemMessage(hwnd, IDC_SLIDER4, TBM_SETTICFREQ, 2, 0); SendDlgItemMessage(hwnd, IDC_SLIDER1, TBM_SETPOS, TRUE, g_nMatrixSpeed); SendDlgItemMessage(hwnd, IDC_SLIDER2, TBM_SETPOS, TRUE, g_nDensity); SendDlgItemMessage(hwnd, IDC_SLIDER3, TBM_SETPOS, TRUE, g_nMessageSpeed); SendDlgItemMessage(hwnd, IDC_SLIDER4, TBM_SETPOS, TRUE, g_nFontSize); CheckDlgButton(hwnd, IDC_RANDOM, g_fRandomizeMessages); CheckDlgButton(hwnd, IDC_BOLD, g_fFontBold); AddFonts(GetDlgItem(hwnd, IDC_COMBO2)); index = SendDlgItemMessage(hwnd, IDC_COMBO2, CB_FINDSTRING, 0, (LPARAM)g_szFontName); SendDlgItemMessage(hwnd, IDC_COMBO2, CB_SETCURSEL, index, 0); UpdatePreview(hwnd); return 0; case WM_DESTROY: //DeInitMessage(); return 0; case WM_CTLCOLORSTATIC: if(GetDlgCtrlID((HWND)lParam) == IDC_ABOUT) { SetTextColor((HDC)wParam, RGB(0,80,0)); SetBkColor((HDC)wParam, GetSysColor(COLOR_3DFACE)); return (BOOL)GetSysColorBrush(COLOR_3DFACE); } else if(GetDlgCtrlID((HWND)lParam) == IDC_PREVIEW) { HDC hdc = (HDC)wParam; RECT clip; GetDlgItemText(hwnd, IDC_COMBO1, buf, 256); GetClientRect((HWND)lParam, &rect); if(prevwidth < rect.right) { rect.left = (rect.right-prevwidth) / 2; rect.right = rect.left + prevwidth; } else { rect.left = 0; rect.right = prevwidth; } if(prevheight < rect.bottom) { rect.top = (rect.bottom-prevheight) / 2; rect.bottom = rect.top + prevheight; } else { rect.top = 0; rect.bottom = prevheight; } SetTextColor(hdc, RGB(128,255,128)); SetBkColor(hdc, 0); //SetRect(&rect, 0, 0, PrevMessage->width, MAXMSG_HEIGHT); CopyRect(&clip, &rect);//.........这里部分代码省略.........
开发者ID:469306621,项目名称:Languages,代码行数:101,
示例14: CopyRect//.........这里部分代码省略......... if(m_GI->m_uniformRowHeightFlag) rect.bottom += m_GI->m_defRowHeight; else rect.bottom += m_GI->m_rowHeights[row]; if(rect.top == rect.bottom) continue; rect.right = 0; //check all visible cells in the current row to //see if they need drawing for(x = 0;x < m_GI->m_numberCols;x++){ //skip cols hidden under locked cols if(x == m_GI->m_numLockCols) x = m_GI->m_leftCol; row = y; col = x; //calc the left and right side of the rect rect.left = rect.right; rect.right += m_GI->m_colInfo[col].width; if(rect.left == rect.right) continue; //check to see if the cell need to be redrawn if(m_drawHint.IsInvalid(col,row) != FALSE){ //copy the rect, then use the cellRect from here //this is done since the cellRect may be modified CopyRect(&cellRect,&rect); //get the cell to draw m_ctrl->GetCellIndirect(col,row,&cell); //check to see if the cell is joined if(cell.IsPropertySet(UGCELL_JOIN_SET)){ m_ctrl->GetCellRect(col,row,&cellRect); m_ctrl->GetJoinStartCell(&col,&row,&cell); if(m_drawHint.IsValid(col,row)) continue; m_drawHint.SetAsValid(col,row); } //get the cell type to draw the cell if(cell.IsPropertySet(UGCELL_CELLTYPE_SET)){ cellType = m_ctrl->GetCellType(cell.GetCellType()); } else { cellType = m_ctrl->GetCellType(-1); } dcID = dc->SaveDC(); //draw the cell, check to see if it is 'current' and/or selected CopyRect(&tempRect,&cellRect); if(row == m_GI->m_currentRow && ( col == m_GI->m_currentCol || m_GI->m_highlightRowFlag)) cellType->OnDraw(dc,&cellRect,col,row,&cell,0,1); else{ if(m_GI->m_multiSelect->IsSelected(col,row,&selectBlock)) cellType->OnDraw(dc,&cellRect,col,row,&cell,selectBlock+1,0);
开发者ID:mpatwa,项目名称:CCEtoODB_Translator,代码行数:67,
示例15: RichUtil_Procstatic LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){ TRichUtil *ru; EnterCriticalSection(&csRich); ru = rlist_find(slist, hwnd); LeaveCriticalSection(&csRich); switch(msg) { case WM_THEMECHANGED: case WM_STYLECHANGED: RichUtil_ClearUglyBorder(ru); break; case WM_NCPAINT: { LRESULT ret = mir_callNextSubclass(hwnd, RichUtil_Proc, msg, wParam, lParam); if (ru->hasUglyBorder && IsThemeActive()) { HANDLE hTheme = OpenThemeData(ru->hwnd, L"EDIT"); if (hTheme) { RECT rcBorder; RECT rcClient; int nState; HDC hdc = GetWindowDC(ru->hwnd); GetWindowRect(hwnd, &rcBorder); rcBorder.right -= rcBorder.left; rcBorder.bottom -= rcBorder.top; rcBorder.left = rcBorder.top = 0; CopyRect(&rcClient, &rcBorder); rcClient.left += ru->rect.left; rcClient.top += ru->rect.top; rcClient.right -= ru->rect.right; rcClient.bottom -= ru->rect.bottom; ExcludeClipRect(hdc, rcClient.left, rcClient.top, rcClient.right, rcClient.bottom); if(IsThemeBackgroundPartiallyTransparent(hTheme, EP_EDITTEXT, ETS_NORMAL)) DrawThemeParentBackground(hwnd, hdc, &rcBorder); if (!IsWindowEnabled(hwnd)) nState = ETS_DISABLED; else if(SendMessage(hwnd, EM_GETOPTIONS, 0, 0) & ECO_READONLY) nState = ETS_READONLY; else nState = ETS_NORMAL; DrawThemeBackground(hTheme, hdc, EP_EDITTEXT, nState, &rcBorder, NULL); CloseThemeData(hTheme); ReleaseDC(hwnd, hdc); return 0; } } return ret; } case WM_NCCALCSIZE: { LRESULT ret = mir_callNextSubclass(hwnd, RichUtil_Proc, msg, wParam, lParam); NCCALCSIZE_PARAMS *ncsParam = (NCCALCSIZE_PARAMS*)lParam; if (ru->hasUglyBorder && IsThemeActive()) { HANDLE hTheme = OpenThemeData(hwnd, L"EDIT"); if (hTheme) { RECT rcClient; HDC hdc = GetDC(GetParent(hwnd)); ZeroMemory(&rcClient, sizeof(RECT)); if(GetThemeBackgroundContentRect(hTheme, hdc, EP_EDITTEXT, ETS_NORMAL, &ncsParam->rgrc[0], &rcClient) == S_OK) { ru->rect.left = rcClient.left-ncsParam->rgrc[0].left; ru->rect.top = rcClient.top-ncsParam->rgrc[0].top; ru->rect.right = ncsParam->rgrc[0].right-rcClient.right; ru->rect.bottom = ncsParam->rgrc[0].bottom-rcClient.bottom; CopyRect(&ncsParam->rgrc[0], &rcClient); CloseThemeData(hTheme); ReleaseDC(GetParent(hwnd), hdc); return WVR_REDRAW; } ReleaseDC(GetParent(hwnd), hdc); CloseThemeData(hTheme); } } return ret; } case WM_ENABLE: RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE|RDW_NOCHILDREN|RDW_UPDATENOW|RDW_FRAME); break; case WM_DESTROY: { LRESULT ret = mir_callNextSubclass(hwnd, RichUtil_Proc, msg, wParam, lParam); EnterCriticalSection(&csRich); slist = rlist_remove(slist, ru); LeaveCriticalSection(&csRich); if (ru) free(ru); return ret; } } return mir_callNextSubclass(hwnd, RichUtil_Proc, msg, wParam, lParam);}
开发者ID:Ganster41,项目名称:miranda-ng,代码行数:95,
示例16: iiDebo1_renderMemory////////////// The Oppie-1 memory block is one of two banks, either showing the first// 1KB of its 2KB RAM, or the second.//////// void iiDebo1_renderMemory(void) { s32 lnI, lnJ, lnOffset; RECT lrc, lrcAddress, lrcDelta; s8 buffer[256]; ////////// // Fill the background ////// SetRect(&lrc, 35, 23, bmpMemory->bi.biWidth - 1, bmpMemory->bi.biHeight - 1); iBmp_fillRect(bmpMemory, &bmpMemory->rc, memoryBorderColor, memoryBorderColor, memoryBorderColor, memoryBorderColor, false, &lrc, true); iBmp_fillRect(bmpMemory, &lrc, memoryFillColor, memoryFillColor, memoryFillColor, memoryFillColor, false, NULL, false); SetRect(&lrc, 0, 23, 35, bmpMemory->bi.biHeight - 1); iBmp_fillRect(bmpMemory, &lrc, memoryOptionColor, memoryOptionColor, memoryOptionColor, memoryOptionColor, false, NULL, false); ////////// // Options ////// if (gnMemoryPage == 0) { // 1 KB page BitBlt(bmpMemory->hdc, 36, 0, bmp1KbOver->bi.biWidth - 1, bmp1KbOver->bi.biHeight - 1, bmp1KbOver->hdc, 0, 0, SRCCOPY); BitBlt(bmpMemory->hdc, 111, 0, bmp2Kb->bi.biWidth - 1, bmp2Kb->bi.biHeight - 1, bmp2Kb->hdc, 0, 0, SRCCOPY); } else { // 2 KB page BitBlt(bmpMemory->hdc, 36, 0, bmp1Kb->bi.biWidth - 1, bmp1Kb->bi.biHeight - 1, bmp1Kb->hdc, 0, 0, SRCCOPY); BitBlt(bmpMemory->hdc, 111, 0, bmp2KbOver->bi.biWidth - 1, bmp2KbOver->bi.biHeight - 1, bmp2KbOver->hdc, 0, 0, SRCCOPY); } BitBlt(bmpMemory->hdc, 357, 0, bmp8BitsOver->bi.biWidth - 1, bmp8BitsOver->bi.biHeight - 1, bmp8BitsOver->hdc, 0, 0, SRCCOPY); BitBlt(bmpMemory->hdc, 422, 0, bmp16Bits->bi.biWidth - 1, bmp16Bits->bi.biHeight - 1, bmp16Bits->hdc, 0, 0, SRCCOPY); BitBlt(bmpMemory->hdc, 488, 0, bmp32Bits->bi.biWidth - 1, bmp32Bits->bi.biHeight - 1, bmp32Bits->hdc, 0, 0, SRCCOPY); BitBlt(bmpMemory->hdc, 552, 0, bmp64Bits->bi.biWidth - 1, bmp64Bits->bi.biHeight - 1, bmp64Bits->hdc, 0, 0, SRCCOPY); ////////// // Memory page ////// sprintf(buffer, "000:/0"); CopyRect(&lrcAddress, &lrc); SetRect(&lrc, 40, 25, bmpMemory->bi.biWidth - 1, bmpMemory->bi.biHeight - 1); SetBkMode(bmpMemory->hdc, TRANSPARENT); SelectObject(bmpMemory->hdc, fontUbuntuMono8->hfont); DrawText(bmpMemory->hdc, buffer, strlen(buffer), &lrcDelta, DT_CALCRECT); lrcDelta.bottom -= 2; for (lnI = gnMemoryPage * 1024; lnI < (gnMemoryPage + 1) * 1024; lnI += 32) { ////////// // Display the address ////// sprintf(buffer, " %03x:/0", lnI); SetTextColor(bmpMemory->hdc, RGB(whiteColor.red, whiteColor.grn, whiteColor.blu)); DrawText(bmpMemory->hdc, buffer, strlen(buffer), &lrcAddress, DT_LEFT); ////////// // Contents ////// // Build the line memset(buffer, 32, 32 * 3); for (lnOffset = 0, lnJ = lnI, buffer[0] = 0; lnOffset < 32; lnOffset++) sprintf(buffer + (lnOffset * 3), "%02x /0", ram[lnJ + lnOffset]); // Draw the line SetTextColor(bmpMemory->hdc, RGB(blackColor.red, blackColor.grn, blackColor.blu)); DrawText(bmpMemory->hdc, buffer, 32 * 3, &lrc, DT_LEFT | DT_SINGLELINE); ////////// // If any of the addresses are in this range, highlight them ////// if (state.pipeStage >= _STAGE1) iiDebo1_renderMemory_highlightMemory(lnI, lnI + 32, pipe1.ip, bmpMemory, &lrc, stage1LowColor, 3); if (state.pipeStage >= _STAGE2) iiDebo1_renderMemory_highlightMemory(lnI, lnI + 32, pipe2.ip, bmpMemory, &lrc, stage2LowColor, ((pipe2.p2_increment2) ? 2 : 1)); if (state.pipeStage >= _STAGE3) iiDebo1_renderMemory_highlightMemory(lnI, lnI + 32, pipe3.ip, bmpMemory, &lrc, stage3LowColor, ((pipe3.p2_increment2) ? 2 : 1)); if (state.pipeStage >= _STAGE4) iiDebo1_renderMemory_highlightMemory(lnI, lnI + 32, pipe4.ip, bmpMemory, &lrc, stage4LowColor, ((pipe4.p2_increment2) ? 2 : 1)); if (state.pipeStage >= _STAGE5) iiDebo1_renderMemory_highlightMemory(lnI, lnI + 32, pipe5.ip, bmpMemory, &lrc, stage5LowColor, ((pipe5.p2_increment2) ? 2 : 1)); ////////// // Move down ////// lrcAddress.top += (lrcDelta.bottom - lrcDelta.top); lrc.top += (lrcDelta.bottom - lrcDelta.top); } }
开发者ID:jhernancanom,项目名称:libsf,代码行数:94,
示例17: switch//.........这里部分代码省略......... case WMSZ_BOTTOM: { KeepWindowFOV(pRect, WMSZ_BOTTOM, WMSZ_TOPLEFT); } break; case WMSZ_TOPLEFT: { KeepWindowFOV(pRect, WMSZ_TOP, WMSZ_BOTTOMRIGHT); } break; } return TRUE; } break; // 窗口尺寸发生了改变后 case WM_WINDOWPOSCHANGING: { WINDOWPOS* pPos = (WINDOWPOS*)lParam; // 非大小改变 if(pPos->flags & SWP_NOSIZE || pPos->flags & SWP_DRAWFRAME) break; // 是“全屏”状态 if(s_pVariableSystem && s_pVariableSystem->GetAs_Int("View_FullScreen")) break; // 计算新的Client RECT rectFrame; SetRect(&rectFrame, 0, 0, pPos->cx, pPos->cy); OffsetRect(&rectFrame, pPos->x, pPos->y); RECT rectNewFrame; CopyRect(&rectNewFrame, &rectFrame); KeepWindowFOV(&rectNewFrame, -1, WMSZ_TOPLEFT); // 如果相同不处理 if(EqualRect(&rectFrame, &rectNewFrame)) break; pPos->x = rectNewFrame.left; pPos->y = rectNewFrame.top; pPos->cx = rectNewFrame.right-rectNewFrame.left; pPos->cy = rectNewFrame.bottom-rectNewFrame.top; return 0; } break; // 桌面分辨率改变 case WM_DISPLAYCHANGE: { if( s_pEventSystem && s_pVariableSystem->GetAs_Int("View_FullScreen")) { s_pEventSystem->PushEvent(GE_VARIABLE_CHANGED, "View_FullScreen", "1"); } // 重置分辨率 if(m_bMaximized) { ShowWindow(g_hMainWnd, SW_RESTORE); ShowWindow(g_hMainWnd, SW_MAXIMIZE); } else { s_pEventSystem->PushEvent(GE_VARIABLE_CHANGED, "View_Resoution", s_pVariableSystem->GetAs_String("View_Resoution").c_str());
开发者ID:gitrider,项目名称:wxsj2,代码行数:67,
示例18: iiDebo1_render////////////// Called to render the Debo1 window.// Note: Renders into the bmpDebo1->hdc bitmap for later copying with BitBlt().// Note: The file debo-1.png was used as a template for this construction.//////// void iiDebo1_render(void) { RECT lrc; ////////// // Render the sub-components ////// iiDebo1_renderStage1(); iiDebo1_renderStage2(); iiDebo1_renderStage3(); iiDebo1_renderStage4(); iiDebo1_renderStage5(); iiDebo1_renderRegisters(); iiDebo1_renderDisassembly(); iiDebo1_renderMemory(); ////////// // The main window has a white background, and then each component is rendered atop ////// FillRect(bmpDebo1->hdc, &bmpDebo1->rc, (HBRUSH)GetStockObject(WHITE_BRUSH)); ////////// // Title ////// CopyRect(&lrc, &bmpDebo1->rc); --lrc.top; lrc.left += 8; SelectObject(bmpDebo1->hdc, fontUbuntu14->hfont); SetBkMode(bmpDebo1->hdc, TRANSPARENT); SetTextColor(bmpDebo1->hdc, RGB(titleColor.red, titleColor.grn, titleColor.blu)); DrawText(bmpDebo1->hdc, cgcAppTitle, strlen(cgcAppTitle), &lrc, DT_LEFT); ////////// // Pipeline stages ////// BitBlt(bmpDebo1->hdc, 5, 28, bmpStage1->bi.biWidth, bmpStage1->bi.biHeight, bmpStage1->hdc, 0, 0, SRCCOPY); BitBlt(bmpDebo1->hdc, 78, 28, bmpStage2->bi.biWidth, bmpStage2->bi.biHeight, bmpStage2->hdc, 0, 0, SRCCOPY); BitBlt(bmpDebo1->hdc, 178, 28, bmpStage3->bi.biWidth, bmpStage3->bi.biHeight, bmpStage3->hdc, 0, 0, SRCCOPY); BitBlt(bmpDebo1->hdc, 278, 9, bmpStage4->bi.biWidth, bmpStage4->bi.biHeight, bmpStage4->hdc, 0, 0, SRCCOPY); BitBlt(bmpDebo1->hdc, 528, 28, bmpStage5->bi.biWidth, bmpStage5->bi.biHeight, bmpStage5->hdc, 0, 0, SRCCOPY); ////////// // Registers ////// BitBlt(bmpDebo1->hdc, 618, 2, bmpRegisters->bi.biWidth, bmpRegisters->bi.biHeight, bmpRegisters->hdc, 0, 0, SRCCOPY); ////////// // Disassembly ////// BitBlt(bmpDebo1->hdc, 618, 173, bmpDisassembly->bi.biWidth, bmpDisassembly->bi.biHeight, bmpDisassembly->hdc, 0, 0, SRCCOPY); ////////// // Memory ////// BitBlt(bmpDebo1->hdc, 0, 154, bmpMemory->bi.biWidth, bmpMemory->bi.biHeight, bmpMemory->hdc, 0, 0, SRCCOPY); }
开发者ID:jhernancanom,项目名称:libsf,代码行数:70,
示例19: NotifyWndProc//.........这里部分代码省略......... 0, g_NotifyInfo.closeBtnSize, g_NotifyInfo.closeBtnSize, RGB(255, 0, 255)); EndPaint(hWnd, &ps); } return TRUE; case WM_ERASEBKGND: return TRUE; case WM_UPDATEPROGRESS: pInfo = (LPNOTIFYWND_DATA)GetWindowLongPtr(hWnd, GWLP_USERDATA); if(pInfo == NULL) return TRUE; if(pInfo->mode == MODE_PROGRESS) { LPCTSTR pStr = (LPCTSTR)lParam; if(pStr != NULL) _tcscpy_s(pInfo->szProgressText, _ARRAYSIZE(pInfo->szProgressText), pStr); pInfo->progress = (int)wParam; //绘制进度条 HGDIOBJ hOldFont = SelectObject(pInfo->hMemDC, g_NotifyInfo.hFontContent); SetTextColor(pInfo->hMemDC, g_NotifyInfo.clrContent); FillRect(pInfo->hMemDC, &pInfo->rcProgressText, (HBRUSH)GetStockObject(WHITE_BRUSH)); DrawText(pInfo->hMemDC, pInfo->szProgressText, -1, &pInfo->rcProgressText, DT_LEFT | DT_TOP | DT_SINGLELINE); SelectObject(pInfo->hMemDC, hOldFont); FillRect(pInfo->hMemDC, &pInfo->rcProgressBar, (HBRUSH)GetStockObject(WHITE_BRUSH)); CopyRect(&rc, &pInfo->rcProgressBar); rc.right = pInfo->rcProgressBar.left + (pInfo->rcProgressBar.right - pInfo->rcProgressBar.left) * pInfo->progress / 100; FillRect(pInfo->hMemDC, &rc, GetSysColorBrush(COLOR_ACTIVECAPTION)); //pInfo->hBrush); if(pInfo->progress >= 100) { //5 秒后自动隐藏 pInfo->bDownloading = FALSE; SetTimer(hWnd, TIMERID_NOTIFY_HIDE, 2000, NULL); } UnionRect(&rc, &pInfo->rcProgressText, &pInfo->rcProgressBar); InvalidateRect(hWnd, &rc, FALSE); } return TRUE; case WM_MOUSEMOVE: { pInfo = (LPNOTIFYWND_DATA)GetWindowLongPtr(hWnd, GWLP_USERDATA); if(pInfo == NULL) return TRUE; pt.x = GET_X_LPARAM(lParam); pt.y = GET_Y_LPARAM(lParam); BOOL bTmp = PtInRect(&pInfo->rcCloseBtn, pt); if(bTmp != pInfo->bMouseOnClose) { pInfo->bMouseOnClose = bTmp; InvalidateRect(hWnd, &pInfo->rcCloseBtn, FALSE); } TrackMouseEvent(&pInfo->tme); }
开发者ID:zcp0415,项目名称:CloudDesktop,代码行数:67,
示例20: AddNextContiguousRectangle// ----------------------------------------------------------------------------//// AddNextContiguousRectangle()// This is called from RemoveGaps to find the next contiguous rectangle// in the array. If there are no more contiguous rectangles it picks the// closest rectangle and moves it so it is contiguous.//// ----------------------------------------------------------------------------LPRECT FAR * NEAR PASCAL AddNextContiguousRectangle(LPRECT FAR *aprc, LPRECT FAR *pprcSplit, UINT count){ LPRECT FAR *pprcL; LPRECT FAR *pprcTest; LPRECT FAR *pprcAxis; LPRECT FAR *pprcDiag; UINT dAxis = (UINT)-1; UINT dDiag = (UINT)-1; POINT dpAxis; POINT dpDiag; POINT dpMove; pprcL = aprc + count; for (pprcTest = aprc; pprcTest < pprcSplit; pprcTest++) { LPRECT lprcTest = *pprcTest; LPRECT FAR *pprcScan; for (pprcScan = pprcSplit; pprcScan < pprcL; pprcScan++) { RECT rcCheckOverlap; LPRECT lprcScan = *pprcScan; LPRECT FAR *pprcCheckOverlap; LPRECT FAR *FAR *pppBest; LPPOINT pdpBest; UINT FAR *pdBest; UINT dX, dY; UINT dTotal; // // Figure out how far the rectangle may be along both axes. // Note some of these numbers could be garbage at this point but // the code below will take care of it. // if (lprcScan->right <= lprcTest->left) dpMove.x = dX = lprcTest->left - lprcScan->right; else dpMove.x = -(int)(dX = (lprcScan->left - lprcTest->right)); if (lprcScan->bottom <= lprcTest->top) dpMove.y = dY = lprcTest->top - lprcScan->bottom; else dpMove.y = -(int)(dY = (lprcScan->top - lprcTest->bottom)); // // Figure out whether the rectangles are vertical, horizontal or // diagonal to each other and pick the measurements we will test. // if ((lprcScan->top < lprcTest->bottom) && (lprcScan->bottom > lprcTest->top)) { // The rectangles are somewhat horizontally aligned. dpMove.y = dY = 0; pppBest = &pprcAxis; pdpBest = &dpAxis; pdBest = &dAxis; } else if ((lprcScan->left < lprcTest->right) && (lprcScan->right > lprcTest->left)) { // The rectangles are somewhat vertically aligned. dpMove.x = dX = 0; pppBest = &pprcAxis; pdpBest = &dpAxis; pdBest = &dAxis; } else { // The rectangles are somewhat diagonally aligned. pppBest = &pprcDiag; pdpBest = &dpDiag; pdBest = &dDiag; } // // Make sure there aren't other rectangles in the way. We only // need to check the upper array since that is the pool of // semi-placed rectangles. Any rectangles in the lower array that // are "in the way" will be found in a different iteration of the // enclosing loop. // CopyRect(&rcCheckOverlap, lprcScan); OffsetRect(&rcCheckOverlap, dpMove.x, dpMove.y); for (pprcCheckOverlap = pprcScan + 1; pprcCheckOverlap < pprcL; pprcCheckOverlap++) { RECT rc; if (IntersectRect(&rc, *pprcCheckOverlap, &rcCheckOverlap))//.........这里部分代码省略.........
开发者ID:conioh,项目名称:os-design,代码行数:101,
示例21: DecryptProc// Message handler for about box.INT_PTR CALLBACK DecryptProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam){ UNREFERENCED_PARAMETER(lParam); switch (message) { case WM_INITDIALOG: // Get the owner window and dialog box rectangles. HWND hwndOwner; RECT rc, rcDlg, rcOwner; if ((hwndOwner = GetParent(hDlg)) == NULL) { hwndOwner = GetDesktopWindow(); } GetWindowRect(hwndOwner, &rcOwner); GetWindowRect(hDlg, &rcDlg); CopyRect(&rc, &rcOwner); // Offset the owner and dialog box rectangles so that right and bottom // values represent the width and height, and then offset the owner again // to discard space taken up by the dialog box. OffsetRect(&rcDlg, -rcDlg.left, -rcDlg.top); OffsetRect(&rc, -rc.left, -rc.top); OffsetRect(&rc, -rcDlg.right, -rcDlg.bottom); // The new position is the sum of half the remaining space and the owner's // original position. SetWindowPos(hDlg, HWND_TOP, rcOwner.left + (rc.right / 2), rcOwner.top + (rc.bottom / 2), 0, 0, // Ignores size arguments. SWP_NOSIZE); SetWindowText(hDlg, szFile); return (INT_PTR)TRUE; case WM_COMMAND: if (LOWORD(wParam) == IDOK) { TCHAR pwd[MAX_PASSWORD]; GetDlgItemText(hDlg, IDC_PWD, pwd, MAX_PASSWORD); if (!wcslen(pwd)) { MessageBox(hDlg, L"Password cannot be empty", L"Password error", MB_ICONERROR); break; } if (!SodiumDecryptFile(pwd)) { sodium_memzero(pwd, MAX_PASSWORD); break; } sodium_memzero(pwd, MAX_PASSWORD); EndDialog(hDlg, LOWORD(wParam)); PostQuitMessage(0); return (INT_PTR)TRUE; } else if (LOWORD(wParam) == IDCANCEL) { EndDialog(hDlg, LOWORD(wParam)); PostQuitMessage(0); return (INT_PTR)TRUE; } break; } return (INT_PTR)FALSE;}
开发者ID:yorickdewid,项目名称:yCrypt,代码行数:73,
示例22: AlignRectsBOOLAlignRects(LPRECT arc, DWORD cCount, DWORD iPrimary, DWORD dwFlags){ LPRECT lprc, lprcL; // // Limit for loops. // lprcL = arc + cCount; // // We don't need to get all worked up if there is only one rectangle. // if (cCount > MONITORS_MAX) { return FALSE; } if (cCount > 1) { if (!(dwFlags & CUDR_NOSNAPTOGRID)) { // // Align monitors on 8 pixel boundaries so GDI can use the same // brush realization on compatible devices (BIG performance win). // Note that we assume the size of a monitor will be in multiples // of 8 pixels on X and Y. We cannot do this for the work areas so // we convert them to be relative to the origins of their monitors // for the time being. // // The way we do this alignment is to just do the overlap/gap // resoluton in 8 pixel space (ie divide everything by 8 beforehand // and multiply it by 8 afterward). // // Note: WE CAN'T USE MULTDIV HERE because it introduces one-off // errors when monitors span the origin. These become eight-off // errors when we scale things back up and we end up trying to // create DCs with sizes like 632x472 etc (not too good). It also // handles rounding the wierdly in both positive and negative space // and we just want to snap things to a grid so we compensate for // truncation differently here. // for (lprc = arc; lprc < lprcL; lprc++) { RECT rc; int d; CopyRect(&rc, lprc); d = rc.right - rc.left; if (rc.left < 0) rc.left -= 4; else rc.left += 3; rc.left /= 8; rc.right = rc.left + (d / 8); d = rc.bottom - rc.top; if (rc.top < 0) rc.top -= 4; else rc.top += 3; rc.top /= 8; rc.bottom = rc.top + (d / 8); CopyRect(lprc, &rc); } } // // RemoveGaps is designed assuming that none of the rectangles that it // is passed will overlap. Thus we cannot safely call it if we have // skipped the call to RemoveOverlaps or it might loop forever. // if (!(dwFlags & CUDR_NORESOLVEPOSITIONS)) { RemoveOverlaps(arc, cCount); if (!(dwFlags & CUDR_NOCLOSEGAPS)) { RemoveGaps(arc, cCount); } } if (!(dwFlags & CUDR_NOSNAPTOGRID)) { // // Now return the monitor rectangles to pixel units this is a // simple multiply and MultDiv doesn't offer us any code size // advantage so (I guess that assumes a bit about the compiler, // but...) just do it right here. ////.........这里部分代码省略.........
开发者ID:conioh,项目名称:os-design,代码行数:101,
示例23: CopyRect//用以保持窗口比例不发生改变//最大化除外VOID CGameProcedure::KeepWindowFOV(RECT* pRect, UINT dwChanging, UINT dwAnchor){ RECT rectTemp; CopyRect(&rectTemp, pRect); rectTemp.left -= m_rectFCOffset.left; rectTemp.top -= m_rectFCOffset.top; rectTemp.right -= m_rectFCOffset.right; rectTemp.bottom -= m_rectFCOffset.bottom; if(WMSZ_LEFT == dwChanging || WMSZ_RIGHT == dwChanging) { //宽不变 rectTemp.bottom = rectTemp.top + (INT)((rectTemp.right-rectTemp.left)*m_fWindowFOV); } else if(WMSZ_TOP == dwChanging || WMSZ_BOTTOM == dwChanging) { //高不变 rectTemp.right = rectTemp.left + (INT)((rectTemp.bottom-rectTemp.top)/m_fWindowFOV); } else { //根据比例自动调节 FLOAT fFov = (FLOAT)(rectTemp.bottom-rectTemp.top)/(FLOAT)(rectTemp.right-rectTemp.left); if(fFov > m_fWindowFOV) { rectTemp.bottom = rectTemp.top + (INT)((rectTemp.right-rectTemp.left)*m_fWindowFOV); } else { rectTemp.right = rectTemp.left + (INT)((rectTemp.bottom-rectTemp.top)/m_fWindowFOV); } } AdjustWindowRect(&rectTemp, DEFWINDOW_STYLE, FALSE); switch(dwAnchor) { case WMSZ_TOPLEFT: { pRect->right = pRect->left + (rectTemp.right-rectTemp.left); pRect->bottom = pRect->top + (rectTemp.bottom-rectTemp.top); } break; case WMSZ_TOPRIGHT: { pRect->left = pRect->right - (rectTemp.right-rectTemp.left); pRect->bottom = pRect->top + (rectTemp.bottom-rectTemp.top); } break; case WMSZ_BOTTOMLEFT: { pRect->right = pRect->left + (rectTemp.right-rectTemp.left); pRect->top = pRect->bottom - (rectTemp.bottom-rectTemp.top); } break; case WMSZ_BOTTOMRIGHT: { pRect->left = pRect->right - (rectTemp.right-rectTemp.left); pRect->top = pRect->bottom - (rectTemp.bottom-rectTemp.top); } break; }}
开发者ID:ueverything,项目名称:mmo-resourse,代码行数:69,
示例24: DrawStuffvoid DrawStuff(LPDRAWITEMSTRUCT lpDrawItem){ PUSERKEYINFO pui; DRAWSTRUCT *ds; LISTSTRUCT *ls; int index; RECT rc; //HICON hIcon; HWND hDlg,hwndList; int max; BOOL focused; focused=TRUE; if(lpDrawItem->hwndItem!=0) { if(GetFocus()!=lpDrawItem->hwndItem) focused=FALSE; } hwndList=lpDrawItem->hwndItem; hDlg=GetParent(hwndList); ls=GetListStruct(hwndList); ds=GetDrawStruct(hDlg); pui=(PUSERKEYINFO)(lpDrawItem->itemData); CopyRect(&rc,&(lpDrawItem->rcItem));#ifdef _WIN32 ImageList_Draw(ds->hIml,pui->icon, lpDrawItem->hDC, rc.left+((CX_SMICON-16)/2), rc.top+((CY_SMICON-16)/2), ILD_TRANSPARENT);#else hIcon=LoadIcon(gPGPsdkUILibInst,MAKEINTRESOURCE(pui->icon)); DrawIcon(lpDrawItem->hDC, rc.left+((CX_SMICON-32)/2), rc.top+((CY_SMICON-32)/2), hIcon); DeleteObject(hIcon);#endif rc.right=rc.left; rc.left=rc.left+16; max=0; for(index=0;index<NUMCOLUMNS;index++) {#if LISTBOX max=max+ls->colwidth[index];#else max=max+ ListView_GetColumnWidth(lpDrawItem->hwndItem,index);#endif } for(index=0;index<NUMCOLUMNS;index++) {#if LISTBOX rc.right=rc.right+ls->colwidth[index];#else rc.right=rc.right+ ListView_GetColumnWidth(lpDrawItem->hwndItem,index);#endif switch(index) { case 0: { HFONT oldFont; RECT origrc; // Save original rect CopyRect(&origrc,&rc); oldFont=SelectObject(lpDrawItem->hDC, ds->hFont); if(pui->pru->kind==kPGPRecipientUserKind_MissingRecipient) SelectObject(lpDrawItem->hDC, ds->hStrikeOut); // See if we need the lock icon if(pui->pru->lockRefCount!=0) { RECT temprc; CopyRect(&temprc,&rc); temprc.left=temprc.right-16; if(temprc.left>rc.left) { // Enough space. Draw Lock if((BOOL)(lpDrawItem->itemState & ODS_SELECTED)&&focused) { FillRect (lpDrawItem->hDC, &temprc, ds->HighBrush); } else//.........这里部分代码省略.........
开发者ID:ysangkok,项目名称:pgp-win32-6.5.8,代码行数:101,
示例25: RichUtil_Procstatic LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){ TRichUtil *ru = NULL, tru; int idx; LRESULT ret; tru.hwnd = hwnd; { mir_cslock lck(csRich); if (List_GetIndex(&sListInt, &tru, &idx)) ru = (TRichUtil *)sListInt.items[idx]; } switch (msg) { case WM_THEMECHANGED: case WM_STYLECHANGED: RichUtil_ClearUglyBorder(ru); break; case WM_NCPAINT: ret = mir_callNextSubclass(hwnd, RichUtil_Proc, msg, wParam, lParam); if (ru->hasUglyBorder && IsThemeActive()) { HANDLE hTheme = OpenThemeData(ru->hwnd, L"EDIT"); if (hTheme) { RECT rcBorder; RECT rcClient; int nState; HDC hdc = GetWindowDC(ru->hwnd); GetWindowRect(hwnd, &rcBorder); rcBorder.right -= rcBorder.left; rcBorder.bottom -= rcBorder.top; rcBorder.left = rcBorder.top = 0; CopyRect(&rcClient, &rcBorder); rcClient.left += ru->rect.left; rcClient.top += ru->rect.top; rcClient.right -= ru->rect.right; rcClient.bottom -= ru->rect.bottom; ExcludeClipRect(hdc, rcClient.left, rcClient.top, rcClient.right, rcClient.bottom); if (IsThemeBackgroundPartiallyTransparent(hTheme, EP_EDITTEXT, ETS_NORMAL)) DrawThemeParentBackground(hwnd, hdc, &rcBorder); if (!IsWindowEnabled(hwnd)) nState = ETS_DISABLED; else if (SendMessage(hwnd, EM_GETOPTIONS, 0, 0) & ECO_READONLY) nState = ETS_READONLY; else nState = ETS_NORMAL; DrawThemeBackground(hTheme, hdc, EP_EDITTEXT, nState, &rcBorder, NULL); CloseThemeData(hTheme); ReleaseDC(hwnd, hdc); return 0; } } return ret; case WM_NCCALCSIZE: { ret = mir_callNextSubclass(hwnd, RichUtil_Proc, msg, wParam, lParam); NCCALCSIZE_PARAMS *ncsParam = (NCCALCSIZE_PARAMS *)lParam; if (ru->hasUglyBorder && IsThemeActive()) { HANDLE hTheme = OpenThemeData(hwnd, L"EDIT"); if (hTheme) { RECT rcClient = {0}; HDC hdc = GetDC(GetParent(hwnd)); if (GetThemeBackgroundContentRect(hTheme, hdc, EP_EDITTEXT, ETS_NORMAL, &ncsParam->rgrc[0], &rcClient) == S_OK) { ru->rect.left = rcClient.left - ncsParam->rgrc[0].left; ru->rect.top = rcClient.top - ncsParam->rgrc[0].top; ru->rect.right = ncsParam->rgrc[0].right - rcClient.right; ru->rect.bottom = ncsParam->rgrc[0].bottom - rcClient.bottom; ncsParam->rgrc[0] = rcClient; CloseThemeData(hTheme); ReleaseDC(GetParent(hwnd), hdc); return WVR_REDRAW; } ReleaseDC(GetParent(hwnd), hdc); CloseThemeData(hTheme); } } } return ret; case WM_ENABLE: RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE | RDW_NOCHILDREN | RDW_UPDATENOW | RDW_FRAME); break; case WM_GETDLGCODE: return mir_callNextSubclass(hwnd, RichUtil_Proc, msg, wParam, lParam) & ~DLGC_HASSETSEL; case WM_NCDESTROY: ret = mir_callNextSubclass(hwnd, RichUtil_Proc, msg, wParam, lParam); { mir_cslock lck(csRich); List_Remove(&sListInt, idx); }//.........这里部分代码省略.........
开发者ID:Seldom,项目名称:miranda-ng,代码行数:101,
示例26: DrawBarvoid DrawBar(DRAWSTRUCT *ds,HDC hdc,RECT *ptrBarRect, int DataValue,int MaxValue,BOOL Selected){ RECT rc; HBRUSH oldbrush,barbrush; HPEN oldpen; COLORREF oldbkcolor; int cx; CopyRect(&rc,ptrBarRect); if(Selected) { FillRect (hdc, &rc, ds->HighBrush); oldpen = SelectObject (hdc, ds->g_unseltextpen); } else { FillRect (hdc, &rc, ds->BackBrush); oldpen = SelectObject (hdc, ds->g_seltextpen); } rc.top+=5; rc.left+=5; rc.bottom-=5; rc.right-=5; if(rc.right<=rc.left) return; cx=rc.right-rc.left; oldbrush = SelectObject (hdc, ds->barbgbrush); SelectObject (hdc, ds->buttonpen); Rectangle (hdc, rc.left - 1, rc.top - 1, rc.right + 2, rc.bottom + 2); SelectObject (hdc, ds->shadowpen); MoveToEx (hdc, rc.left, rc.bottom, NULL); LineTo (hdc, rc.left, rc.top); LineTo (hdc, rc.right, rc.top); SelectObject (hdc, ds->hilightpen); LineTo (hdc, rc.right, rc.bottom); LineTo (hdc, rc.left, rc.bottom); if (MaxValue != 0) { if (DataValue > MaxValue) { barbrush = ds->spcbarbrush; rc.right = rc.left + cx; } else { barbrush = ds->stdbarbrush; rc.right = rc.left + (int)(((float)DataValue / (float)MaxValue) * (float)cx); } } else rc.right = rc.left; rc.top++; rc.left++; if (rc.right > rc.left) { oldbkcolor=SetBkColor (hdc, ds->barcolor); FillRect (hdc, &rc, barbrush); rc.top--; rc.left--; // hilight pen already selected MoveToEx (hdc, rc.right, rc.top, NULL); LineTo (hdc, rc.left, rc.top); LineTo (hdc, rc.left,rc.bottom); SelectObject (hdc, ds->shadowpen); LineTo (hdc, rc.right, rc.bottom); LineTo (hdc, rc.right, rc.top); SetBkColor(hdc,oldbkcolor); } SelectObject (hdc, oldbrush); SelectObject (hdc, oldpen);}
开发者ID:ysangkok,项目名称:pgp-win32-6.5.8,代码行数:91,
示例27: PaintWorker//.........这里部分代码省略......... else DrawEdge(hdcMem, &rc, BDR_RAISEDOUTER, BF_RECT | BF_SOFT); } else if(ctl->stateId == PBS_PRESSED) DrawEdge(hdcMem, &rc, BDR_SUNKENOUTER, BF_RECT | BF_SOFT); } } } else { // Draw background/border if(ctl->hThemeButton && ctl->bThemed) { int state = IsWindowEnabled(ctl->hwnd) ? (ctl->stateId == PBS_NORMAL && ctl->defbutton ? PBS_DEFAULTED : ctl->stateId) : PBS_DISABLED; POINT pt; RECT rcParent; GetWindowRect(ctl->hwnd, &rcParent); pt.x = rcParent.left; pt.y = rcParent.top; ScreenToClient(pcli->hwndContactList, &pt); BitBlt(hdcMem, 0, 0, rcClient.right, rcClient.bottom, cfg::dat.hdcBg, pt.x, pt.y, SRCCOPY); if(Api::pfnIsThemeBackgroundPartiallyTransparent(ctl->hThemeButton, BP_PUSHBUTTON, state)) { Api::pfnDrawThemeParentBackground(ctl->hwnd, hdcMem, &rcClient); } Api::pfnDrawThemeBackground(ctl->hThemeButton, hdcMem, BP_PUSHBUTTON, state, &rcClient, &rcClient); } else { UINT uState = DFCS_BUTTONPUSH | ((ctl->stateId == PBS_HOT) ? DFCS_HOT : 0) | ((ctl->stateId == PBS_PRESSED) ? DFCS_PUSHED : 0); if(ctl->defbutton && ctl->stateId == PBS_NORMAL) uState |= DLGC_DEFPUSHBUTTON; DrawFrameControl(hdcMem, &rcClient, DFC_BUTTON, uState); } // Draw focus rectangle if button has focus if(ctl->focus) { RECT focusRect = rcClient; InflateRect(&focusRect, -3, -3); DrawFocusRect(hdcMem, &focusRect); } } // If we have an icon or a bitmap, ignore text and only draw the image on the button if(ctl->hIcon || ctl->hIconPrivate || ctl->iIcon) { int ix = (rcClient.right - rcClient.left) / 2 - (CXSMICON / 2); int iy = (rcClient.bottom - rcClient.top) / 2 - (CXSMICON / 2); HICON hIconNew = ctl->hIconPrivate != 0 ? ctl->hIconPrivate : ctl->hIcon; if(lstrlen(ctl->szText) == 0) { if(ctl->iIcon) ImageList_DrawEx(ctl->hIml, ctl->iIcon, hdcMem, ix, iy, CXSMICON, CYSMICON, CLR_NONE, CLR_NONE, ILD_NORMAL); else DrawState(hdcMem, NULL, NULL, (LPARAM) hIconNew, 0, ix, iy, CXSMICON, CYSMICON, IsWindowEnabled(ctl->hwnd) ? DST_ICON | DSS_NORMAL : DST_ICON | DSS_DISABLED); ctl->sLabel.cx = ctl->sLabel.cy = 0; } else { GetTextExtentPoint32(hdcMem, ctl->szText, lstrlen(ctl->szText), &ctl->sLabel); if(CXSMICON + ctl->sLabel.cx + 8 > rcClient.right - rcClient.left) ctl->sLabel.cx = (rcClient.right - rcClient.left) - CXSMICON - 8; else ctl->sLabel.cx += 4; ix = (rcClient.right - rcClient.left) / 2 - ((CXSMICON + ctl->sLabel.cx) / 2); if(ctl->iIcon) ImageList_DrawEx(ctl->hIml, ctl->iIcon, hdcMem, ix, iy, CXSMICON, CYSMICON, CLR_NONE, CLR_NONE, ILD_NORMAL); else DrawState(hdcMem, NULL, NULL, (LPARAM) hIconNew, 0, ix, iy, CXSMICON, CYSMICON, IsWindowEnabled(ctl->hwnd) ? DST_ICON | DSS_NORMAL : DST_ICON | DSS_DISABLED); xOffset = ix + CXSMICON + 4; } } else if(ctl->hBitmap) { BITMAP bminfo; int ix, iy; GetObject(ctl->hBitmap, sizeof(bminfo), &bminfo); ix = (rcClient.right - rcClient.left) / 2 - (bminfo.bmWidth / 2); iy = (rcClient.bottom - rcClient.top) / 2 - (bminfo.bmHeight / 2); if(ctl->stateId == PBS_PRESSED) { ix++; iy++; } DrawState(hdcMem, NULL, NULL, (LPARAM) ctl->hBitmap, 0, ix, iy, bminfo.bmWidth, bminfo.bmHeight, IsWindowEnabled(ctl->hwnd) ? DST_BITMAP : DST_BITMAP | DSS_DISABLED); } if(GetWindowTextLength(ctl->hwnd)) { // Draw the text and optinally the arrow RECT rcText; CopyRect(&rcText, &rcClient); SetBkMode(hdcMem, TRANSPARENT); if(!ctl->bSkinned) Gfx::setTextColor(IsWindowEnabled(ctl->hwnd) || !ctl->hThemeButton ? GetSysColor(COLOR_BTNTEXT) : GetSysColor(COLOR_GRAYTEXT)); if(ctl->arrow) { DrawState(hdcMem, NULL, NULL, (LPARAM) ctl->arrow, 0, rcClient.right - rcClient.left - 5 - CXSMICON + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), (rcClient.bottom - rcClient.top) / 2 - CYSMICON / 2 + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), CXSMICON, CYSMICON, IsWindowEnabled(ctl->hwnd) ? DST_ICON : DST_ICON | DSS_DISABLED); rcText.left += (4 + CXSMICON); } if(xOffset) rcText.left += (4 + CXSMICON); Gfx::renderText(hdcMem, ctl->hThemeButton, ctl->szText, &rcText, DT_VCENTER | DT_CENTER | DT_SINGLELINE, 0); } if(hOldFont) SelectObject(hdcMem, hOldFont);#ifndef _USE_D2D FINALIZE_PAINT(hbp, &rcBp, 0);#endif }}
开发者ID:Seldom,项目名称:miranda-ng,代码行数:101,
示例28: CopyRectvoid Canvas::CopyRect(const Rect &r, const Rect &r2){ CopyRect(r, r2.left, r2.top);}
开发者ID:HTshandou,项目名称:newos,代码行数:4,
示例29: GetWindowLong/*================rvGENavigator::WndProcWindow Procedure================*/LRESULT CALLBACK rvGENavigator::WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) { rvGENavigator *nav = ( rvGENavigator * ) GetWindowLong( hWnd, GWL_USERDATA ); switch( msg ) { case WM_INITMENUPOPUP: return SendMessage( gApp.GetMDIFrame( ), msg, wParam, lParam ); case WM_ACTIVATE: common->ActivateTool( LOWORD( wParam ) != WA_INACTIVE ); break; case WM_ERASEBKGND: return TRUE; case WM_DESTROY: gApp.GetOptions().SetWindowPlacement( "navigator", hWnd ); break; case WM_CLOSE: gApp.GetOptions().SetNavigatorVisible( false ); nav->Show( false ); return 0; case WM_DRAWITEM: { DRAWITEMSTRUCT *dis = ( DRAWITEMSTRUCT * ) lParam; idWindow *window = ( idWindow * )dis->itemData; if( window ) { rvGEWindowWrapper *wrapper = rvGEWindowWrapper::GetWrapper( window ); idStr name = window->GetName(); RECT rDraw; float offset; bool disabled; idWindow *parent = window; offset = 1; disabled = false; while( parent = parent->GetParent( ) ) { if( rvGEWindowWrapper::GetWrapper( parent )->IsHidden( ) ) { disabled = true; } offset += 10; } CopyRect( &rDraw, &dis->rcItem ); rDraw.right = rDraw.left + GENAV_ITEMHEIGHT; rDraw.top ++; rDraw.right ++; FrameRect( dis->hDC, &rDraw, ( HBRUSH )GetStockObject( BLACK_BRUSH ) ); rDraw.right --; FillRect( dis->hDC, &rDraw, GetSysColorBrush( COLOR_3DFACE ) ); Draw3dRect( dis->hDC, &rDraw, GetSysColorBrush( COLOR_3DHILIGHT ), GetSysColorBrush( COLOR_3DSHADOW ) ); InflateRect( &rDraw, -3, -3 ); Draw3dRect( dis->hDC, &rDraw, GetSysColorBrush( COLOR_3DSHADOW ), GetSysColorBrush( COLOR_3DHILIGHT ) ); if( !wrapper->IsHidden( ) ) { DrawIconEx( dis->hDC, rDraw.left, rDraw.top, disabled ? nav->mVisibleIconDisabled : nav->mVisibleIcon, 16, 16, 0, NULL, DI_NORMAL ); } CopyRect( &rDraw, &dis->rcItem ); rDraw.left += GENAV_ITEMHEIGHT; rDraw.left += 1; if( dis->itemState & ODS_SELECTED ) { FillRect( dis->hDC, &rDraw, GetSysColorBrush( COLOR_HIGHLIGHT ) ); } else { FillRect( dis->hDC, &rDraw, GetSysColorBrush( COLOR_WINDOW ) ); } if( wrapper->CanHaveChildren( ) && window->GetChildCount( ) ) { if( wrapper->IsExpanded( ) ) { DrawIconEx( dis->hDC, rDraw.left + offset, rDraw.top + 3, nav->mCollapseIcon, 16, 16, 0, NULL, DI_NORMAL ); } else { DrawIconEx( dis->hDC, rDraw.left + offset, rDraw.top + 3, nav->mExpandIcon, 16, 16, 0, NULL, DI_NORMAL ); } } HPEN pen = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_3DSHADOW ) ); HPEN oldpen = ( HPEN )SelectObject( dis->hDC, pen ); MoveToEx( dis->hDC, rDraw.left, dis->rcItem.top, NULL ); LineTo( dis->hDC, dis->rcItem.right, dis->rcItem.top ); MoveToEx( dis->hDC, rDraw.left, dis->rcItem.bottom, NULL ); LineTo( dis->hDC, dis->rcItem.right, dis->rcItem.bottom ); SelectObject( dis->hDC, oldpen ); DeleteObject( pen ); rDraw.left += offset; rDraw.left += 20; int colorIndex = ( ( dis->itemState & ODS_SELECTED ) ? COLOR_HIGHLIGHTTEXT : COLOR_WINDOWTEXT ); SetTextColor( dis->hDC, GetSysColor( colorIndex ) ); DrawText( dis->hDC, name, name.Length(), &rDraw, DT_LEFT | DT_VCENTER | DT_SINGLELINE ); if( wrapper->GetVariableDict().GetNumKeyVals( ) || wrapper->GetScriptDict().GetNumKeyVals( ) ) { DrawIconEx( dis->hDC, dis->rcItem.right - 16, ( dis->rcItem.bottom + dis->rcItem.top ) / 2 - 6, ( dis->itemState & ODS_SELECTED ) ? nav->mScriptsLightIcon : nav->mScriptsIcon, 13, 13, 0, NULL, DI_NORMAL ); } } break; } case WM_MEASUREITEM: { MEASUREITEMSTRUCT *mis = ( MEASUREITEMSTRUCT * ) lParam; mis->itemHeight = 22; break; } case WM_CREATE: { LPCREATESTRUCT cs; LVCOLUMN col; // Attach the class to the window first cs = ( LPCREATESTRUCT ) lParam; nav = ( rvGENavigator * ) cs->lpCreateParams;//.........这里部分代码省略.........
开发者ID:SL987654,项目名称:The-Darkmod-Experimental,代码行数:101,
示例30: CopyRectvoid cListCtrl::SetMargin(const RECT * textRelRect){ CopyRect(&m_textRelRect, textRelRect);}
开发者ID:xianyinchen,项目名称:LUNAPlus,代码行数:4,
注:本文中的CopyRect函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ CopyStr函数代码示例 C++ CopyMemory函数代码示例 |