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.
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

Postby harshdeep » Fri Jul 21, 2017 11:29 am

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: 11290
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: C++ wxWidgets panel set Background coloru

Postby doublemax » Fri Jul 21, 2017 12:10 pm

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

Postby harshdeep » Sat Jul 22, 2017 10:06 am

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: 11290
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: C++ wxWidgets panel set Background coloru

Postby doublemax » Sat Jul 22, 2017 11:05 am

And i don't see any image and it would be better if you posted code as text.
Use the source, Luke!

Nunki
Earned some good credits
Earned some good credits
Posts: 125
Joined: Fri Sep 14, 2012 8:26 am
Location: Kontich, Belgium
Contact:

Re: C++ wxWidgets panel set Background coloru

Postby Nunki » Sun Jul 30, 2017 7:09 pm

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


Return to “C++ Development”

Who is online

Users browsing this forum: No registered users and 7 guests