jkribaHTS
asked on
Transparent CStatic in CView
Hi,
I am trying to Create a Static Text Control dynamically in the View [Derived from CView] of an MFC SDI application,
And i want to provide Transparency for the Text Background since the View has some texture in the background,
I have tried various options by Overriding the OnDraw of the CStatic control class and setting SetBKMode(Transparent)..
Nothing works with the View, Any help will be really helpful..Thanks
Regards
JK
I am trying to Create a Static Text Control dynamically in the View [Derived from CView] of an MFC SDI application,
And i want to provide Transparency for the Text Background since the View has some texture in the background,
I have tried various options by Overriding the OnDraw of the CStatic control class and setting SetBKMode(Transparent)..
Nothing works with the View, Any help will be really helpful..Thanks
Regards
JK
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
the question should be deleted.
the solution jkr posted cannot work since the status words stored by SetWindowLong were not evaluated again for static mfc controls. hence the call was without any effect. the attributes only could be set when creating the controls what is not easily to achieve since mfc static controls cannot made owner-drawn windows. the way out is to create a customized window derived from CWnd but surely that is another game.
Sara
the solution jkr posted cannot work since the status words stored by SetWindowLong were not evaluated again for static mfc controls. hence the call was without any effect. the attributes only could be set when creating the controls what is not easily to achieve since mfc static controls cannot made owner-drawn windows. the way out is to create a customized window derived from CWnd but surely that is another game.
Sara
if you want to change the colors of a child control, you need to override the OnCtlColor member function of our view class.
see sample code at https://msdn.microsoft.com/de-de/library/0wwk06hc.aspx
Sara