本文整理汇总了C++中CDuiRect::Offset方法的典型用法代码示例。如果您正苦于以下问题:C++ CDuiRect::Offset方法的具体用法?C++ CDuiRect::Offset怎么用?C++ CDuiRect::Offset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDuiRect
的用法示例。
在下文中一共展示了CDuiRect::Offset方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnGetMinMaxInfo
LRESULT WindowImplBase::OnGetMinMaxInfo(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
LPMINMAXINFO lpMMI = (LPMINMAXINFO) lParam;
MONITORINFO oMonitor = {};
oMonitor.cbSize = sizeof(oMonitor);
::GetMonitorInfo(::MonitorFromWindow(*this, MONITOR_DEFAULTTONEAREST), &oMonitor);
CDuiRect rcWork = oMonitor.rcWork;
CDuiRect rcMonitor = oMonitor.rcMonitor;
rcWork.Offset(-oMonitor.rcMonitor.left, -oMonitor.rcMonitor.top);
// 计算最大化时,正确的原点坐标
lpMMI->ptMaxPosition.x = rcWork.left;
lpMMI->ptMaxPosition.y = rcWork.top;
lpMMI->ptMaxTrackSize.x = lpMMI->ptMaxSize.x = rcWork.GetWidth();
lpMMI->ptMaxTrackSize.y = lpMMI->ptMaxSize.y = rcWork.GetHeight();
if (m_PaintManager.GetMaxInfo().cx != 0) {
lpMMI->ptMaxTrackSize.x = lpMMI->ptMaxSize.x = m_PaintManager.GetMaxInfo().cx;
}
if (m_PaintManager.GetMaxInfo().cy != 0) {
lpMMI->ptMaxTrackSize.y = lpMMI->ptMaxSize.y = m_PaintManager.GetMaxInfo().cy;
}
lpMMI->ptMinTrackSize.x =m_PaintManager.GetMinInfo().cx;
lpMMI->ptMinTrackSize.y =m_PaintManager.GetMinInfo().cy;
bHandled = TRUE;
return 0;
}
示例2: OnNcCalcSize
LRESULT WindowImplBase::OnNcCalcSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
LPRECT pRect=NULL;
if ( wParam == TRUE)
{
LPNCCALCSIZE_PARAMS pParam = (LPNCCALCSIZE_PARAMS)lParam;
pRect=&pParam->rgrc[0];
}
else
{
pRect=(LPRECT)lParam;
}
if ( ::IsZoomed(m_hWnd))
{ // 最大化时,计算当前显示器最适合宽高度
MONITORINFO oMonitor = {};
oMonitor.cbSize = sizeof(oMonitor);
::GetMonitorInfo(::MonitorFromWindow(*this, MONITOR_DEFAULTTONEAREST), &oMonitor);
CDuiRect rcWork = oMonitor.rcWork;
CDuiRect rcMonitor = oMonitor.rcMonitor;
rcWork.Offset(-oMonitor.rcMonitor.left, -oMonitor.rcMonitor.top);
pRect->right = pRect->left + rcWork.GetWidth();
pRect->bottom = pRect->top + rcWork.GetHeight();
return WVR_REDRAW;
}
return 0;
}
示例3: OnSize
LRESULT CMenuWnd::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
SIZE szRoundCorner = m_pm.GetRoundCorner();
if( !::IsIconic(*this) ) {
CDuiRect rcWnd;
::GetWindowRect(*this, &rcWnd);
rcWnd.Offset(-rcWnd.left, -rcWnd.top);
rcWnd.right++; rcWnd.bottom++;
HRGN hRgn = ::CreateRoundRectRgn(rcWnd.left, rcWnd.top, rcWnd.right, rcWnd.bottom, szRoundCorner.cx, szRoundCorner.cy);
::SetWindowRgn(*this, hRgn, TRUE);
::DeleteObject(hRgn);
}
bHandled = FALSE;
return 0;
}
示例4: OnSize
LRESULT CHelloWorld::OnSize( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled )
{
SIZE szRoundCorner = m_pm.GetRoundCorner(); // GetRoundCorner用来获取xml中的Window标签中roundcorner属性值,该值指示圆角的长宽
if( !::IsIconic(*this) && (szRoundCorner.cx != 0 || szRoundCorner.cy != 0) ) {
CDuiRect rcWnd;
::GetWindowRect(*this, &rcWnd);
rcWnd.Offset(-rcWnd.left, -rcWnd.top); // rcWnd.right就成为了窗口的宽度了
rcWnd.right++; rcWnd.bottom++;
HRGN hRgn = ::CreateRoundRectRgn(rcWnd.left, rcWnd.top, rcWnd.right, rcWnd.bottom, szRoundCorner.cx, szRoundCorner.cy);
::SetWindowRgn(*this, hRgn, TRUE); // 窗口圆角化处理
::DeleteObject(hRgn);
}
bHandled = FALSE;
return 0;
}
示例5: OnSize
LRESULT WindowImplBase::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
SIZE szRoundCorner = m_PaintManager.GetRoundCorner();
#if defined(WIN32) && !defined(UNDER_CE)
if( !::IsIconic(*this) && (szRoundCorner.cx != 0 || szRoundCorner.cy != 0) ) {
CDuiRect rcWnd;
::GetWindowRect(*this, &rcWnd);
rcWnd.Offset(-rcWnd.left, -rcWnd.top);
rcWnd.right++; rcWnd.bottom++;
HRGN hRgn = ::CreateRoundRectRgn(rcWnd.left, rcWnd.top, rcWnd.right, rcWnd.bottom, szRoundCorner.cx, szRoundCorner.cy);
::SetWindowRgn(*this, hRgn, TRUE);
::DeleteObject(hRgn);
}
#endif
bHandled = FALSE;
return 0;
}
示例6: OnGetMinMaxInfo
LRESULT imsdkDemoLogin::OnGetMinMaxInfo(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
MONITORINFO oMonitor = {};
oMonitor.cbSize = sizeof(oMonitor);
::GetMonitorInfo(::MonitorFromWindow(*this, MONITOR_DEFAULTTOPRIMARY), &oMonitor);
CDuiRect rcWork = oMonitor.rcWork;
rcWork.Offset(-oMonitor.rcMonitor.left, -oMonitor.rcMonitor.top);
LPMINMAXINFO lpMMI = (LPMINMAXINFO)lParam;
lpMMI->ptMaxPosition.x = rcWork.left;
lpMMI->ptMaxPosition.y = rcWork.top;
lpMMI->ptMaxSize.x = rcWork.right;
lpMMI->ptMaxSize.y = rcWork.bottom;
bHandled = FALSE;
return 0;
}
示例7: OnSize
LRESULT WindowImplBase::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
if (m_bFrameWnd) {
bHandled = FALSE;
return 0;
}
SIZE szRoundCorner = m_PaintManager.GetRoundCorner();
#if defined(WIN32) && !defined(UNDER_CE)
if( !::IsIconic(*this) && (szRoundCorner.cx != 0 || szRoundCorner.cy != 0) ) {
CDuiRect rcWnd;
::GetWindowRect(*this, &rcWnd);
rcWnd.Offset(-rcWnd.left, -rcWnd.top);
rcWnd.right++;
rcWnd.bottom++;
HRGN hRgn = ::CreateRoundRectRgn(rcWnd.left, rcWnd.top, rcWnd.right, rcWnd.bottom, szRoundCorner.cx, szRoundCorner.cy);
::SetWindowRgn(*this, hRgn, TRUE);
::DeleteObject(hRgn);
}
#endif
if (wParam != m_dwWindowPosState
&& (wParam==SIZE_MAXIMIZED || wParam==SIZE_RESTORED)
&& GetManager()->GetRoot())
{
CControlUI* btnmax = FindControl(_T("maxbtn"));
CControlUI* btnrestore = FindControl(_T("restorebtn"));
if (btnmax && btnrestore) {
if (wParam == SIZE_MAXIMIZED) {
btnmax->SetVisible(false);
btnrestore->SetVisible(true);
}
else {
btnmax->SetVisible(true);
btnrestore->SetVisible(false);
}
}
}
m_dwWindowPosState = wParam;
bHandled = FALSE;
return 0;
}
示例8: OnSize
LRESULT WindowImplBase::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
SIZE szRoundCorner = m_PaintManager.GetRoundCorner();
if( !::IsIconic(*this) && (szRoundCorner.cx != 0 || szRoundCorner.cy != 0) ) {
CDuiRect rcWnd;
::GetWindowRect(*this, &rcWnd);
rcWnd.Offset(-rcWnd.left, -rcWnd.top);
rcWnd.right++; rcWnd.bottom++;
HRGN hRgn = ::CreateRoundRectRgn(rcWnd.left, rcWnd.top, rcWnd.right, rcWnd.bottom, szRoundCorner.cx, szRoundCorner.cy);
::SetWindowRgn(*this, hRgn, TRUE);
::DeleteObject(hRgn);
}
CDuiRect rcWnd;
::GetWindowRect(*this, &rcWnd);
DUITRACE(_T("WinImplBase::OnSize(), width = %d, height = %d"), rcWnd.right - rcWnd.left, rcWnd.bottom - rcWnd.top);
DUITRACE(_T("WinImplBase::OnSize(): %d, width = %d, height = %d"), wParam, LOWORD(lParam), HIWORD(lParam));
bHandled = FALSE;
return 0;
}
示例9: OnSize
LRESULT CMenuWnd::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
if( !::IsIconic(*this) )
{
CDuiRect rcWnd;
::GetWindowRect(*this, &rcWnd);
rcWnd.Offset(-rcWnd.left, -rcWnd.top);
HRGN hRgn = ::CreateRectRgn(rcWnd.left + 8, rcWnd.top + 8, rcWnd.right - 8, rcWnd.bottom - 8);
::SetWindowRgn(*this, hRgn, TRUE);
::DeleteObject(hRgn);
}
if( m_pShadowWnd != NULL )
{
RECT rcWnd = { 0 };
::GetWindowRect(m_hWnd, &rcWnd );
::SetWindowPos(*m_pShadowWnd, m_hWnd, rcWnd.left, rcWnd.top, rcWnd.right -rcWnd.left,
rcWnd.bottom -rcWnd.top, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER);
}
bHandled = FALSE;
return 0;
}
示例10: OnSize
LRESULT WindowImplBase::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
SIZE szRoundCorner = m_PaintManager.GetRoundCorner();
#if defined(WIN32) && !defined(UNDER_CE)
if( !::IsIconic(*this) && (szRoundCorner.cx != 0 || szRoundCorner.cy != 0) ) {
CDuiRect rcWnd;
::GetWindowRect(*this, &rcWnd);
rcWnd.Offset(-rcWnd.left, -rcWnd.top);
rcWnd.right++; rcWnd.bottom++;
HRGN hRgn = ::CreateRoundRectRgn(rcWnd.left, rcWnd.top, rcWnd.right, rcWnd.bottom, szRoundCorner.cx, szRoundCorner.cy);
::SetWindowRgn(*this, hRgn, TRUE);
::DeleteObject(hRgn);
}
#endif
// 切换最大化按钮和还原按钮的状态
if (wParam != m_dwWindowPosState && (wParam == SIZE_MAXIMIZED || wParam == SIZE_RESTORED) && GetPaintManager()->GetRoot())
{
CControlUI* pbtnMax = static_cast<CControlUI*>(m_PaintManager.FindControl(_T("maxbtn"))); // 最大化按钮
CControlUI* pbtnRestore = static_cast<CControlUI*>(m_PaintManager.FindControl(_T("restorebtn"))); // 还原按钮
if (pbtnMax && pbtnRestore){
if (wParam == SIZE_MAXIMIZED){
pbtnMax->SetVisible(false);
pbtnRestore->SetVisible(true);
}
else{
pbtnMax->SetVisible(true);
pbtnRestore->SetVisible(false);
}
}
}
//m_dwWindowPosState来保存上一次的窗口状态, 只有当状态不同时才会切换按钮.
m_dwWindowPosState = wParam;
bHandled = FALSE;
return 0;
}
示例11: PaintText
void CRollTextUI::PaintText(HDC hDC)
{
if( m_dwTextColor == 0 ) m_dwTextColor = m_pManager->GetDefaultFontColor();
if( m_dwDisabledTextColor == 0 ) m_dwDisabledTextColor = m_pManager->GetDefaultDisabledColor();
DWORD dwTextColor = IsEnabled() ? m_dwTextColor : m_dwDisabledTextColor;
CDuiString sText = GetText();
if( sText.IsEmpty() ) return;
RECT rcTextPadding = GetTextPadding();
CDuiRect rcClient;
rcClient = m_rcItem;
rcClient.left += rcTextPadding.left;
rcClient.right -= rcTextPadding.right;
rcClient.top += rcTextPadding.top;
rcClient.bottom -= rcTextPadding.bottom;
if(m_nText_W_H > 0)
{
int nScrollRange = 0;
if (m_nRollDirection == ROLLTEXT_LEFT || m_nRollDirection == ROLLTEXT_RIGHT) { //左面移动
nScrollRange = m_nText_W_H + rcClient.GetWidth();
rcClient.Offset((m_nRollDirection == ROLLTEXT_LEFT?rcClient.GetWidth():-rcClient.GetWidth()), 0);
rcClient.Offset((m_nRollDirection == ROLLTEXT_LEFT?-m_nScrollPos:m_nScrollPos), 0);
rcClient.right += (m_nText_W_H - rcClient.GetWidth());
} else { //上下移动
nScrollRange = m_nText_W_H + rcClient.GetHeight();
rcClient.Offset(0, (m_nRollDirection == ROLLTEXT_UP?rcClient.GetHeight():-rcClient.GetHeight()));
rcClient.Offset(0, (m_nRollDirection == ROLLTEXT_UP?-m_nScrollPos:m_nScrollPos));
rcClient.bottom += (m_nText_W_H - rcClient.GetHeight());
}
m_nScrollPos += m_nStep;
if (m_nScrollPos > nScrollRange)
{
m_nScrollPos = 0;
}
}
RECT rc = rcClient;
UINT uTextStyle = DT_WORDBREAK | DT_EDITCONTROL;
if(m_nText_W_H == 0)
{
uTextStyle |= DT_CALCRECT; //第一次计算文本宽度或高度
if (m_nRollDirection == ROLLTEXT_LEFT || m_nRollDirection == ROLLTEXT_RIGHT) { //左面移动
rc.right += 10000;
} else { //上下移动
rc.bottom += 10000;
}
}
if( m_bShowHtml ) {
int nLinks = 0;
CRenderEngine::DrawHtmlText(hDC, m_pManager, rc, sText, dwTextColor, NULL, NULL, nLinks, m_iFont, uTextStyle);
} else {
CRenderEngine::DrawText(hDC, m_pManager, rc, sText, dwTextColor, m_iFont, uTextStyle);
}
if(m_nText_W_H == 0)
{
m_nText_W_H = (m_nRollDirection == ROLLTEXT_LEFT || m_nRollDirection == ROLLTEXT_RIGHT)?(rc.right - rc.left):(rc.bottom - rc.top); //计算文本宽度或高度
}
}