compnerd / swift-win32

A Windows application framework for Swift
https://compnerd.github.io/swift-win32/
BSD 3-Clause "New" or "Revised" License
1.11k stars 69 forks source link

Support set background color for View #758

Open jctaoo opened 1 year ago

jctaoo commented 1 year ago

view.backgroundColor = xx is not work currently

compnerd commented 1 year ago

Each view has a hWnd associated with it. It should be possible to create a new solid brush and set that via SetWindowLongPtrW. I don't remember if we have a lifetime wrapper for brushes, but that should be pretty easy to create via the generic ManagedHandle type. A patch for this would be a nice addition.