C++ wxWidgets panel set Background coloru

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
harshdeep
In need of some credit
In need of some credit
Posts: 4
Joined: Wed Jul 05, 2017 9:28 am

C++ wxWidgets panel set Background coloru

Post by harshdeep »

Hi ,

I try C++ in wxWidgets Panel Set Background Color but not get result .

SetBackgroundColour(wxColour(77,77,77));

using function above but not net resulte.
User avatar
doublemax
Moderator
Moderator
Posts: 19103
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: C++ wxWidgets panel set Background coloru

Post by doublemax »

Can you show the whole code in context? Maybe you're setting the background color for the wxFrame which is completely covered by a wxPanel?
Use the source, Luke!
harshdeep
In need of some credit
In need of some credit
Posts: 4
Joined: Wed Jul 05, 2017 9:28 am

Re: C++ wxWidgets panel set Background coloru

Post by harshdeep »

Hi doublemax thank for replay i have attach image so you get batter idea about

i hope you will be understand my problem and also mark area to change background .
Last edited by harshdeep on Mon Jul 24, 2017 8:12 am, edited 1 time in total.
User avatar
doublemax
Moderator
Moderator
Posts: 19103
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: C++ wxWidgets panel set Background coloru

Post by doublemax »

And i don't see any image and it would be better if you posted code as text.
Use the source, Luke!
Nunki
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 235
Joined: Fri Sep 14, 2012 8:26 am
Location: Kontich, Belgium
Contact:

Re: C++ wxWidgets panel set Background coloru

Post by Nunki »

Hi Harshdeep,

Like Doublemax said, you need to be sure your using the method on the right object. For that you first need to get the pointer to your wxPanel, and then use the method SetBackgroundColour.

Code: Select all

wxPanel *hPnl;

hPnl =  XRCCTRL(*this, "FIMG_PANEL",wxPanel);
hPnl->SetBackgroundColour(wxColour(77,77,77));
hPnl->Refresh();
.....
Regards,
Nunki
Post Reply