| Create gradient backgrounds on Windows forms |
If you look closely at the code, you'll also
see how to extend the label control to make it use the same gradient and
integrate smoothly into the background (though that's kind of pesky
since you have to place the label with code--this might be practical
only if you have a GUI that doesn't require many labels).
You can also see that the project uses a mostly static Model.cs class
as the start point (Main function); this class also holds the two gradient
colors, so the About form and other forms can find out which colors
to use. In each form, the gradient is created by overriding the OnPaintBackground
event. You can paste this event into
your own projects if you want to use a gradient background.
It was necessary to extend the Label control to force it to display the same gradient as the parent form in a smooth manner.
Note that the OnPaintBackground event uses
GDI
graphics calls which requires a using statement for namespace
System.Drawing.Drawing2D at the top of the form
I think it's kind of fun. In case you don't know what a gradient is,
it looks like this:

Visitors: