Download MetaTrader 5

How to change CAppDialog background color?

To add comments, please log in or register
Mohammad Mohi
237
Mohammad Mohi  
I need to change background color of my Panel derived from CAppDialog, but since m_background is a private member of CDialog, I can't access it and change the color with the function ColorBackground(). I appritiate any help.
Vladimir Karputov
Moderator
50076
Vladimir Karputov  
Mohammad Mohi:
I need to change background color of my Panel derived from CAppDialog, but since m_background is a private member of CDialog, I can't access it and change the color with the function ColorBackground(). I appritiate any help.

Just create your own panel "CPanel" ...

This example is based on a standard of Example ...\MQL5\Experts\Examples\Controls\

Files:
Controls.mq5 3 kb
Mohammad Mohi
237
Mohammad Mohi  
Karputov Vladimir:

Just create your own panel "CPanel" ...

This example is based on a standard of Example ...\MQL5\Experts\Examples\Controls\

Thanks for reply, But I want to change the main CAppDialog background color or caption bar, not the controls on it.
Vladimir Karputov
Moderator
50076
Vladimir Karputov  
Mohammad Mohi:
Thanks for reply, But I want to change the main CAppDialog background color or caption bar, not the controls on it.
Extend my plate - and you can change the background color :). By CAppDialog not have access.
Mohammad Mohi
237
Mohammad Mohi  
Karputov Vladimir:
Extend my plate - and you can change the background color :). By CAppDialog not have access.
That's fine, I know that way but I need to code as less as possible, and want to benefit from further developments made to the Standard Library, that's why I want to try a native way rather than extending, I believe one should be able to change the Panel colors within the inherited class itself.
Ernst Van Der Merwe
4802
Ernst Van Der Merwe  
The simplest way would be to move m_background to protected: but then the code would have to be changed when the class is updated.
aries
51
aries  

Mohammad, how did you solve this?

I have same problem and any way I look at it, it's a lot of hassle. Either I have to change core lib and then keep changing it after every update, or I have to write a sh11ton of code, classes that inherit the core lib but afterward serves basically nothing else.

To add comments, please log in or register