compnerd/swift-win32

Change `Button` to owner drawn class

compnerd opened this issue · 2 comments

Convert the Button implementation to use an owner drawn button. This should allow for changing the button to include an image and title simultaneously. Additionally, it would allow for embedding a Label and ImageView members which can then be made available to the user to control the button more thoroughly.

h4cky commented

Last few days I am playing with BS_OWNERDRAW on Button, and while my drawing code works (for background, border and text colors), I am having issues with passing Button ref to the WndProc which handles the drawing of the Button.

I can't promise anything at the moment.

Ah, you mean the reference to the Button instance? You cannot do that directly; the way to accomplish that is by squirreling away the pointer into GWLP_USERDATA. There are a couple of examples of that in the tree already.