Gradients as Backgrounds

BlitzMax Forums/Brucey's Modules/Gradients as Backgrounds

Glenn Dodd(Posted 2008) [#1]
Hello,
I don't think this is possible but i thought i would ask the wiser people.
I have a bmp image which shows a gradient effect of light at the top down to a slightly darker shade at the bottom.
I want to use it as a background to a window and then put my listboxes and listctrls on top of it. ideally each list control will use the same gradient as its background. It can have quite a nice subtle effect when done properly.

Here is the code


I don't have a site to upload the graphic too but it is a 300 by 300 bmp.
If someone wants to upload it a simple email will get it sent to you.


So far i have the image being displayed but it doesn't stretch with the window.

In my main program i can set the panel and control backgrounds to custom colours but the effect is not as nice as the gradient.

Any suggestions appreciated.

Glenn


Brucey(Posted 2008) [#2]
Here's a slightly modified version.



Note how I subclassed a wxPanel, and have connected to the OnPaint event - this way I can do what I like when it needs to refresh itself.

I had made a more simple version, but it didn't look nice when the window was resized. This version (at least on Win32) appears to scale nicely, without flicker (it uses a double-buffered DC).

Is that what you're after?


Glenn Dodd(Posted 2008) [#3]
Perfect.

Many thanks
Glenn


Brucey(Posted 2008) [#4]
np :-)