コード例 #1
0
ファイル: LightDlg.cpp プロジェクト: Kaan88/doom3.gpl
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
0
ファイル: WarnPopVideo.cpp プロジェクト: dalinhuang/demodemo
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
0
void CBTGVDialogBar::OnUpdate(void)
{
	CSliderCtrl *sRed, *sGreen, *sBlue, *sAlpha, *sBrightness;
	CButton *pButton;
	CEdit *eRed, *eGreen, *eBlue, *eAlpha, *eBrightness;
	char buffer[20];
	CString tRed, tGreen, tBlue, tAlpha, tBrightness;

	sRed = (CSliderCtrl *)GetDlgItem(ID_REDSLIDER);
	sGreen = (CSliderCtrl *)GetDlgItem(ID_GREENSLIDER);
	sBlue = (CSliderCtrl *)GetDlgItem(ID_BLUESLIDER);
	sAlpha = (CSliderCtrl *)GetDlgItem(ID_ALPHASLIDER);
	sBrightness = (CSliderCtrl *)GetDlgItem(ID_BRIGHTNESSSLIDER);
	pButton = (CButton *)GetDlgItem(IDC_COLORPREVIEW);

	eRed = (CEdit *)GetDlgItem(IDC_EDIT1);
	eGreen = (CEdit *)GetDlgItem(IDC_EDIT2);
	eBlue = (CEdit *)GetDlgItem(IDC_EDIT3);
	eAlpha = (CEdit *)GetDlgItem(IDC_EDIT4);
	eBrightness = (CEdit *)GetDlgItem(IDC_EDIT5);

	eRed->GetWindowText(tRed);
	eGreen->GetWindowText(tGreen);
	eBlue->GetWindowText(tBlue);
	eAlpha->GetWindowText(tAlpha);
	eBrightness->GetWindowText(tBrightness);

	// Has the slider changed?
	if((atoi(tRed) == red) && (sRed->GetPos() != red))
	{
		red = sRed->GetPos();
		bUpdate = 1;

		eRed->SetWindowText(itoa(sRed->GetPos(), buffer, 10));
	}

	// Has the edit changed?
	else if((atoi(tRed) != red) && (sRed->GetPos() == red))
	{
		red = atoi(tRed);
		if (red > 255) red = 255;

		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
0
ファイル: WarnPopVideo.cpp プロジェクト: dalinhuang/demodemo
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;

	}

}