本文整理汇总了C++中CButton::GetClientRect方法的典型用法代码示例。如果您正苦于以下问题:C++ CButton::GetClientRect方法的具体用法?C++ CButton::GetClientRect怎么用?C++ CButton::GetClientRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CButton
的用法示例。
在下文中一共展示了CButton::GetClientRect方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ColorButtons
void CLightDlg::ColorButtons() {
CRect r;
CClientDC dc(this);
CButton *pBtn = (CButton *)GetDlgItem(IDC_BTN_COLOR);
pBtn->GetClientRect(&r);
colorBitmap.DeleteObject();
colorBitmap.CreateCompatibleBitmap(&dc, r.Width(), r.Height());
CDC MemDC;
MemDC.CreateCompatibleDC(&dc);
CBitmap *pOldBmp = MemDC.SelectObject(&colorBitmap);
{
CBrush br(RGB(color[0], color[1], color[2]));
MemDC.FillRect(r,&br);
}
dc.SelectObject(pOldBmp);
pBtn->SetBitmap(HBITMAP(colorBitmap));
}
示例2: OnSize
void CWarnPopVideo::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);
// TODO: Add your message handler code here
if ( IsWindow(m_hWnd) && m_pPopView && IsWindow(m_pPopView->m_hWnd) )
{
CButton *pBtn = (CButton *)GetDlgItem(IDOK);
if (pBtn)
{
int dlt = 3;
CRect btnRect, dlgRect;
pBtn->GetClientRect(&btnRect);
//GetClientRect(&dlgRect);
//m_pPopView->MoveWindow(dlgRect.left,dlgRect.top,dlgRect.Width(), dlgRect.Height()-btnRect.Height());
m_pPopView->MoveWindow(0,0,cx, cy-btnRect.Height()-dlt);
}
}
}
示例3: OnUpdate
//.........这里部分代码省略.........
bUpdate = 1;
sRed->SetPos(red);
}
// Has the slider changed?
if((atoi(tGreen) == green) && (sGreen->GetPos() != green))
{
green = sGreen->GetPos();
bUpdate = 1;
eGreen->SetWindowText(itoa(sGreen->GetPos(), buffer, 10));
}
// Has the edit changed?
else if((atoi(tGreen) != green) && (sGreen->GetPos() == green))
{
green = atoi(tGreen);
if (green > 255) green = 255;
bUpdate = 1;
sGreen->SetPos(green);
}
// Has the slider changed?
if((atoi(tBlue) == blue) && (sBlue->GetPos() != blue))
{
blue = sBlue->GetPos();
if (blue > 255) blue = 255;
bUpdate = 1;
eBlue->SetWindowText(itoa(sBlue->GetPos(), buffer, 10));
}
// Has the edit changed?
else if((atoi(tBlue) != blue) && (sBlue->GetPos() == blue))
{
blue = atoi(tBlue);
bUpdate = 1;
sBlue->SetPos(blue);
}
// Has the slider changed?
if((atoi(tAlpha) == alpha) && (sAlpha->GetPos() != alpha))
{
alpha = sAlpha->GetPos();
if (alpha > 255) alpha = 255;
bUpdate = 1;
eAlpha->SetWindowText(itoa(sAlpha->GetPos(), buffer, 10));
}
// Has the edit changed?
else if((atoi(tAlpha) != alpha) && (sAlpha->GetPos() == alpha))
{
alpha = atoi(tAlpha);
bUpdate = 1;
sAlpha->SetPos(alpha);
}
// Has the slider changed?
if((atoi(tBrightness) == brightness) && (sBrightness->GetPos() != brightness))
{
brightness = sBrightness->GetPos();
if (brightness > 255) brightness = 255;
bUpdate = 1;
eBrightness->SetWindowText(itoa(sBrightness->GetPos(), buffer, 10));
}
// Has the edit changed?
else if((atoi(tBrightness) != brightness) && (sBrightness->GetPos() == brightness))
{
brightness = atoi(tBrightness);
bUpdate = 1;
sBrightness->SetPos(brightness);
}
if(bFloating != IsFloating())
{
bUpdate = 1;
bFloating = IsFloating();
}
if(bUpdate)
{
CDC *pDC = pButton->GetDC();
CRect tempRect;
pButton->GetClientRect(&tempRect);
CBrush tempBrush(RGB(red, green, blue));
pDC->SelectObject(&tempBrush);
pDC->Rectangle(tempRect.left, tempRect.top, tempRect.right, tempRect.bottom);
bUpdate = 0;
}
}
示例4: FullScreenPopVideo
void CWarnPopVideo::FullScreenPopVideo(void)
{
if (m_bFullScreen==false) //full screen
{
//Hide OK Button
CButton *pBtnOK = (CButton *)GetDlgItem(IDOK);
if (pBtnOK)
pBtnOK->ShowWindow(SW_HIDE);
CEdit *pEdit = (CEdit*)GetDlgItem(IDC_TIMEOUT);
if (pEdit)
pEdit->ShowWindow(SW_HIDE);
CButton *pBtnPause = (CButton*)GetDlgItem(IDC_PAUSE_ALARM);
if (pBtnPause)
pBtnPause->ShowWindow(SW_HIDE);
//Full Video Screen
GetWindowPlacement(&m_struOldPlacement);
//Remove WS_SIZEBOX windows style. or not the window can't be full-creen.
ModifyStyle(WS_SIZEBOX,0,0);
CRect WindowRect, ClientRect;
RECT m_FullScreenRect;
//ReDraw the window. Get the correct edge value.
GetWindowRect(&WindowRect);
WindowRect.left+=1;
WindowRect.right+=1;
MoveWindow(CRect(0,0,352,288),TRUE);
GetWindowRect(&WindowRect);
GetClientRect(&ClientRect);
ClientToScreen(&ClientRect);
//get the dest window rect.
int x = GetSystemMetrics(SM_CXSCREEN);
int y = GetSystemMetrics(SM_CYSCREEN);
m_FullScreenRect.left = WindowRect.left - ClientRect.left;
m_FullScreenRect.top = WindowRect.top - ClientRect.top;
m_FullScreenRect.right = WindowRect.right - ClientRect.right + x;
m_FullScreenRect.bottom = WindowRect.bottom - ClientRect.bottom + y;
// m_FullScreenRect.left = 0;
// m_FullScreenRect.top = 0;
// m_FullScreenRect.right = GetSystemMetrics(SM_CXSCREEN);
// m_FullScreenRect.bottom = GetSystemMetrics(SM_CYSCREEN);
//Move the main window to the dest rect.
WINDOWPLACEMENT wndpl;
wndpl.length = sizeof(WINDOWPLACEMENT);
wndpl.flags = 0;
wndpl.showCmd = SW_SHOWNORMAL;
wndpl.rcNormalPosition = m_FullScreenRect;
SetWindowPlacement(&wndpl);
//Move the view winow to full-screen.
RECT rc;
GetClientRect(&rc);
m_pPopView->MoveWindow(&rc,TRUE);
//
m_bFullScreen = true;
}
else //Restore normal screen
{
//Show OK Button
CRect btnRect;
CButton *pBtnOK = (CButton *)GetDlgItem(IDOK);
if (pBtnOK)
{
pBtnOK->ShowWindow(SW_SHOW);
pBtnOK->GetClientRect(&btnRect);
}
CEdit *pEdit = (CEdit*)GetDlgItem(IDC_TIMEOUT);
if (pEdit)
pEdit->ShowWindow(SW_SHOW);
CButton *pBtnPause = (CButton*)GetDlgItem(IDC_PAUSE_ALARM);
if (pBtnPause)
pBtnPause->ShowWindow(SW_SHOW);
//Restore old position
ModifyStyle(0,WS_SIZEBOX,0);
SetWindowPlacement(&m_struOldPlacement);
RECT rc;
GetClientRect(&rc);
rc.bottom -= (btnRect.Height()+3);
m_pPopView->MoveWindow(&rc,TRUE);
//SetWindowSize();
//
m_bFullScreen = false;
}
}