Transparent control
-
Hi, I have a dialog that have a bitmap as background. When I put control on the dialog, I can see the surrounding white rectangle around the controls. Is there a way to see my background around the controls and not the white rectangle? for example, suppose that I have a CStatic with text in it, is there a way to to see the bitmap behind the text? thanks Everything's beautiful if you look at it long enough...
-
Hi, I have a dialog that have a bitmap as background. When I put control on the dialog, I can see the surrounding white rectangle around the controls. Is there a way to see my background around the controls and not the white rectangle? for example, suppose that I have a CStatic with text in it, is there a way to to see the bitmap behind the text? thanks Everything's beautiful if you look at it long enough...
-
Does enabling the Transparent property (when right-clicking on the control in the ressource editor) change something ? ~RaGE();
No, enabling the transparent property don't change anything. I have been able to make it work throught OnPaint() redefinition in a CStatic control, but I cannot use to make it work for other controls such as CButton (radio button) for CStatic, in the OnPaint of the control you can use: dc.setBkMode(TRANSPARENT) dc.DrawText(...) Everything's beautiful if you look at it long enough...
-
No, enabling the transparent property don't change anything. I have been able to make it work throught OnPaint() redefinition in a CStatic control, but I cannot use to make it work for other controls such as CButton (radio button) for CStatic, in the OnPaint of the control you can use: dc.setBkMode(TRANSPARENT) dc.DrawText(...) Everything's beautiful if you look at it long enough...
Try adding a handler for OnEraseBkgnd and either doing nothing or erasing the background with a hollow brush. ex: BOOL MyDialog::OnEraseBkgnd( CDC* pDC ) { return TRUE; }
-
Try adding a handler for OnEraseBkgnd and either doing nothing or erasing the background with a hollow brush. ex: BOOL MyDialog::OnEraseBkgnd( CDC* pDC ) { return TRUE; }
Well, I doesn't seem to work, I also tried to use: HBRUSH RightDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { HBRUSH hbr = ShapedDlg::OnCtlColor(pDC, pWnd, nCtlColor); if ( pWnd->GetDlgCtrlID() == IDC_RADIO1) { // m_bkbrush is a CBrush member variable m_bkbrush.CreateStockObject(HOLLOW_BRUSH); pDC->SetBkMode ( TRANSPARENT ); return m_bkbrush; } return hbr; } If I use BLACK_BRUSH, I will see a black background if I use GREY_BRUSH I will see grey background, but HOLLOW_BRUSH give me a strange blue background. Everything's beautiful if you look at it long enough...