阅读背景:

MFC自定义控件背景/文本颜色

来源:互联网 

So I have used MFC for a few years and made various interfaces which include custom controls. I was recently asked to start making an interface which can have dynamically set background and text colors. I started working on this and have been running into an issue getting some of my custom controls to behave. All the controls which generate WM_CTLCOLOR messages work really nicely using that interface to allow the parent to set the colors of the child controls, but not all the controls I have customized generate these messages. Specifically a class I built off of CTabCrtl and a few based on CWnd. These classes don't seem to generate WM_CTLCOLOR messages before they call a paint. I was wondering if anyone had any ideas on how to either get the background and text color of a controls parent CWnd or how to manually create a WM_CTLCOLOR message. I have tried to get the current DC of the controls parent so I can call GetBkColor() and GetTextColor() but doing this always seems to return default values. I have also tried to create WM_CTLCOLOR messages but don't know where I should create them or the exact syntax.. Any help would be great.So I have used MFC for a few years and made var




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: