小弟在看别人的代码发现有这么一个函数,但是不明白什么意思。其中一句是:
if ( DCB_RESET == pDC->GetBoundsRect(&MyRect,DCB_RESET))//MyRect是传进来的参数
pDC->SetBoundsRect(NULL,DCB_ENABLE);通过调试还是不清楚什么意思,在网上查百度词条也不明白什么意思,在整个Microsoft Visual Studio 9.0目录下也没找到GetBoundsRect的实现。请教高人给指点一下GetBoundsRect与SetBoundsRect的用法,具体点,最好能举个例子,另外为什么找不到GetBoundsRect的实现?谢谢了
if ( DCB_RESET == pDC->GetBoundsRect(&MyRect,DCB_RESET))//MyRect是传进来的参数
pDC->SetBoundsRect(NULL,DCB_ENABLE);通过调试还是不清楚什么意思,在网上查百度词条也不明白什么意思,在整个Microsoft Visual Studio 9.0目录下也没找到GetBoundsRect的实现。请教高人给指点一下GetBoundsRect与SetBoundsRect的用法,具体点,最好能举个例子,另外为什么找不到GetBoundsRect的实现?谢谢了
解决方案 »
- 格式化系统时间的问题
- VC连接SQL问题
- 如何实现两个EXCEL的表合并
- 我有1000个邮件地址,如何知道其中哪些邮件地址是无效的、或是已经作废的、或者根本发送不到的。
- 我想做一个位图按扭,但我不想从资源中装载位图ID,而想直接从位图文件装载,不知各位大师有什么方法?这样可以避免应用程序太大
- 奇怪的问题!
- 请详细介绍InvokeHelper
- 利用 NetShareAdd 函数设置共享文件夹访问权限的问题
- 贝塞尔曲线!!!!!!!!求大神点拨!!!!
- 调用外部已经生成的.exe文件,用什么方法?
- 关于CDib类中BITMAPFILEHEADER使用方法的不解
- 关于截取远程主机屏幕的功能的实现,求解!万分感谢!100%结贴
如果成功,则返回外接矩形的当前状态。可以是以下值的组合: DCB_ACCUMULATE 出现外接矩形聚集。
DCB_RESET 外接矩形为空。
DCB_SET 外接矩形非空。
DCB_ENABLE 显示外接矩形。
DCB_DISABLE 不显示外接矩形。 参数: lpRectBounds 指向缓冲区的指针。该缓冲区接收当前的外接矩形,矩形用逻辑坐标表示。
flags 指定当外接矩形返回后是否被清除,可以为下列值之一: · DCB_RESET 返回后被清除。
· DCB_WINDOWMGR 查询Windows而非应用的外接矩形。
说明:为指定设备上下文返回当前聚集的外接矩形。请参阅:CDC::SetBoundsRect, ::GetBoundsRect
http://msdn.microsoft.com/en-us/library/yah4scb3(VS.80).aspx
http://msdn.microsoft.com/en-us/library/05h01afz(VS.80).aspx
因为我调试程序的时候发现传进去的MyRect始终不变,但是GetBoundsRect函数不是把MyRect变成了0就是原封不动。小弟愚昧不理解。请举个例子说明,谢谢。
//CSubWnd是从CWnd派生的
void CSubWnd::Show(CRect MyRect, LPCTSTR MyTipText)
{
CClientDC MyDC(this);
pDC = CDC::FromHandle(MyDC.m_hDC);
CString MyTitle(MyTipText);
MyTitle += _T(" ");
CFont *pFont = m_pMyWnd->GetFont();
pDC->SelectObject(pFont );
CRect MyDisplayRect =MyRect;
if ( DCB_RESET == pDC->GetBoundsRect(&MyRect,DCB_RESET))
pDC->SetBoundsRect(NULL,DCB_ENABLE);
pDC->SetTextColor(RGB(255,255,0));
if( IsWindowVisible() )
{
MoveWindow(MyDisplayRect.left, MyDisplayRect.top,MyDisplayRect.Width(), MyDisplayRect.Height());
pDC->FillSolidRect(&MyRect,RGB(0,0,255));
MyDisplayRect = MyRect;
MyDisplayRect.left += 2;
pDC->DrawText(MyTitle,-1,MyDisplayRect, DT_LEFT | DT_SINGLELINE|DT_NOPREFIX | DT_NOCLIP | DT_VCENTER);
pDC->DrawFocusRect(&MyRect);
}
else
{
SetWindowPos( &wndTop, MyDisplayRect.left, MyDisplayRect.top,MyDisplayRect.Width(), MyDisplayRect.Height(),SWP_SHOWWINDOW|SWP_NOACTIVATE );
pDC->SetBkMode( OPAQUE );
pDC->FillSolidRect(&MyRect,::GetSysColor(COLOR_HIGHLIGHT));
pDC->DrawText(MyTitle,-1,MyDisplayRect, DT_LEFT | DT_SINGLELINE | DT_NOPREFIX |DT_NOCLIP | DT_VCENTER);
pDC->DrawFocusRect(&MyRect);
}
}帮解释一下那句到底什么意思?具体点,谢谢大虾
The accumulated bounding rectangle is the smallest rectangle enclosing the portion of a window or client area affected by recent drawing operations. An application can use this rectangle to conveniently determine the extent of changes caused by drawing operations. It is sometimes used in conjunction with LockWindowUpdate to determine which portion of the client area must be redrawn after the update lock is cleared. An application uses the SetBoundsRect function (specifying DCB_ENABLE) to begin accumulating the bounding rectangle. The system subsequently accumulates points for the bounding rectangle as the application uses the specified display device context. The application can retrieve the current bounding rectangle at any time by using the GetBoundsRect function. The application stops the accumulation by calling SetBoundsRect again, specifying the DCB_DISABLE value.