[wxMSW] How can I create a wxBrush from an existing HBRUSH?

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
tomay3000
I live to help wx-kind
I live to help wx-kind
Posts: 172
Joined: Mon Apr 24, 2017 4:23 am

[wxMSW] How can I create a wxBrush from an existing HBRUSH?

Post by tomay3000 » Sun Aug 02, 2020 3:25 am

Hello,
getting the HBRUSH handle from a wxBrush is easy. But I need to do the inverse, that is create a wxBrush from an existing HBRUSH.
Is it possible? Show me.
TIA.

New Pagodi
Super wx Problem Solver
Super wx Problem Solver
Posts: 347
Joined: Tue Jun 20, 2006 6:47 pm
Contact:

Re: [wxMSW] How can I create a wxBrush from an existing HBRUSH?

Post by New Pagodi » Sun Aug 02, 2020 12:37 pm

There doesn't seem to be a MSW only InitFromHBRUSH method like there is with some of the other GDI objects. But what you can do is call GetObject to get a LOGBRUSH. Then use the information in that structure to create a wxBrush.

tomay3000
I live to help wx-kind
I live to help wx-kind
Posts: 172
Joined: Mon Apr 24, 2017 4:23 am

Re: [wxMSW] How can I create a wxBrush from an existing HBRUSH?

Post by tomay3000 » Sun Aug 02, 2020 10:36 pm

Yeah, that's what I thought, because I have searched everywhere.
I can't convince Vadim either to implement it, because the philosophy to add something to wxWidgets is when it is needed by the toolkit itself, not user code.

Thank you for the hint.

Post Reply