Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Transparent Static Control

Status
Not open for further replies.

dpisarciuc

Programmer
Nov 30, 2004
1
MD
Hi!

I need a transparent static control.
The WS_ES_TRANSPARENT doesn't work properly. To be exactly - it doesn't work at all instead MSDN says what it should make the control transparent.

My control have to by placed on a dialog which has a bitmap in background. And it should be able to change the text...

Drawing such control - no problems...

The BIG problem is WM_SETTEXT, sent by SentWindowText, which have to erase the old text, not affecting the background, and draw the new text.
To reach this effect, i use the next code:


if ( m_bTransparent )
{
CRect rcClient;
GetClientRect(&rcClient);

CWnd* pParent = GetParent();
ClientToScreen(&rcClient);
pParent->ScreenToClient(&rcClient);

SetRedraw(FALSE);
pParent->InvalidateRect(rcClient);
SetRedraw(TRUE);
}

return Default();


It's ok when the control's text is modified rarely, but when is necessary to modify the control's text very often - the control is flickering like crazy.

I think to use double buffering, but how to make the parent to draw it self in my memory dc? After pParent->SendMessage(WM_PAINT, (WPARAM)hMemDC); the dc is filled in black.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top