|
-
February 10th, 2009, 08:44 AM
#1
Transperent background
Hi all,
I have a picture control (bmp) and inside f it I have a static control that displays the current time and gets refreshed every second.
I want to make the static control transperant so that the bmp will be the background
I've tried the following:
Code:
...
m_BrushSol.CreateStockObject(HOLLOW_BRUSH);
...
HBRUSH CMyDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = __super::OnCtlColor(pDC, pWnd, nCtlColor);
if ( pWnd->GetDlgCtrlID() == IDC_TIME )
{
pDC->SetBkMode(TRANSPARENT);
return m_BrushSol;
}
}
That works BUT... when I update the time (every second) , the new time is merging with the old time so I get one big mess after few seconds.
How can I avoid it??
Please help!
-
February 10th, 2009, 09:03 AM
#2
Re: Transperent background
You could save a rectangular bmp which is that occupied by the clock... When you need to refresh it, you can erase the clock background with the original image partial bitmap (overriding the CStatic OnEraseBkgnd() ), and then superpose the new clock.
Sorry, can't think anything more right now...
Last edited by Buzzyous; February 10th, 2009 at 09:05 AM.
- Buzzyous -
-
February 11th, 2009, 08:02 AM
#3
Re: Transperent background
If, by "one big mess", you mean the numbers continue to appear on top of each other until they are unreadable, then, try setting the static control to blanks before updating the time.
Gort...Klaatu, Barada Nikto!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|