当前位置: 首页>>代码示例>>C++>>正文


C++ CopyRect函数代码示例

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


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

示例1: xxxCalcClientRect

void 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,代码来源:calcclrc.c

示例2: MSWDrawXPBackground

static
void 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,代码来源:bmpbuttn.cpp

示例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,代码来源:gdd_checkbox.c

示例4: winInitDialog

static void
winInitDialog (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,代码来源:windialogs.c

示例5: glClear

void 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,代码来源:MemoryCardView.cpp

示例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,代码来源:ugprint.cpp

示例7: ShowNotifyWnd

void 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,代码来源:NotifyWnd.cpp

示例8: VideoRenderer_SetTargetRect

static 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,代码来源:videorenderer.c

示例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,代码来源:toolbar.c

示例10: GetScreenSelection

bool 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,代码来源:ScreenSelector.cpp

示例11: VideoRenderer_GetSourceRect

static 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,代码来源:videorenderer.c

示例12: rectTemp

CSDWindow::CSDWindow(POINT point, SIZE size)
{
	CRect rectTemp(point, size);

	CopyRect(rectTemp);
}
开发者ID:jogunhee,项目名称:ScreenDivider,代码行数:6,代码来源:SDWindow.cpp

示例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,代码来源:config.c

示例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,代码来源:UGGrid.cpp

示例15: RichUtil_Proc

static 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,代码来源:richutil.cpp


注:本文中的CopyRect函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。