wxButton request

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
NonoNano
Experienced Solver
Experienced Solver
Posts: 71
Joined: Sun Mar 25, 2018 6:12 pm

wxButton request

Post by NonoNano »

Hello,

I'm trying to use wxBitmapButton to style my application. I would like to have a square button that shows a certain icon ("Close.png"). Even tought the button and the icon have the same size (40x40) when I draw the icon above the button the button still have some gray margins (I would like the icon to entirely cover the button). How can I achieve this? Thank you!
Attachments
wxBitmapButton.png
wxBitmapButton.png (1.3 KiB) Viewed 1102 times
Close.png
Close.png (1.03 KiB) Viewed 1102 times
User avatar
saifcoder
Experienced Solver
Experienced Solver
Posts: 80
Joined: Thu Nov 16, 2017 9:32 pm

Re: wxButton request

Post by saifcoder »

Please attache the constructor you are using, maybe something like this :

Code: Select all

Foo = new wxBitmapButton(this, ID, wxBitmap(wxImage(_T("Close.png"))), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW, wxDefaultValidator);
Last edited by saifcoder on Wed May 16, 2018 3:41 pm, edited 1 time in total.
Debian 9 - GCC 6 - wxWidgets 3.x U
Win 10 - GCC 8 - wxWidgets 3.x U
Mac OS X 10.x - Clang - wxWidgets 3.x U
i am in love with WX. Yes.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxButton request

Post by ONEEYEMAN »

Hi,
Try to construct wxButton with the wxBU_EXACTFIT style.

Thank you.
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxButton request

Post by doublemax »

I haven't tried it, but my guess is that you'll need a custom control for this. I don't think you can suppress the rendering of the button outline.
Use the source, Luke!
Post Reply