Page 1 of 1

C++ wxWidgets panel set Background coloru

Posted: Fri Jul 21, 2017 11:29 am
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.

Re: C++ wxWidgets panel set Background coloru

Posted: Fri Jul 21, 2017 12:10 pm
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?

Re: C++ wxWidgets panel set Background coloru

Posted: Sat Jul 22, 2017 10:06 am
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 .

Re: C++ wxWidgets panel set Background coloru

Posted: Sat Jul 22, 2017 11:05 am
by doublemax
And i don't see any image and it would be better if you posted code as text.

Re: C++ wxWidgets panel set Background coloru

Posted: Sun Jul 30, 2017 7:09 pm
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