preload
Sep 01

Adding gradient details to your application graphic can make a big difference. The out-of-box support for this in Compact Framework is not very good and you need to custom build controls with gradient support. This post explains how to create your own gradient buttons in .NET Compact Framework.

I have earlier written a post about Creating gradient background with transparent labels in .NET Compact Framework and the approach when creating a gradient button is quite similar. As a base for drawing gradient I use the same GradientFill.cs and Win32Helper.cs that I used and explained when creating gradient background.

The GradientFill.cs and Win32Helper.cs I have got from Microsoft MSDN site: How to Display a Gradient Fill. Their example also have a gradient button, but the example I will show here is a very simple gradient button that is easy to continue developing to suite your needs.

GradientFill.cs

using System;
using System.Diagnostics;
using System.Drawing;
using System.Runtime.InteropServices;

Continue reading »

Tagged with:
May 05

A few days ago I wanted to create a fresher UI then what .NET Compact Framework offers out of the box. I wanted to create a gradient background for the screen and I wanted to have transparent labels on top of the background. In my opinion this is not much to ask for and I was a bit surprised that I actually had to do this myself.

Well after a few hours I made a gradient background and a transparent label. I will now step by step go through my solution.

The first thing I started with was to create a gradient background. I found that the best way achieving this would be to override OnPaintBackground in the Screen class. I found a very good article on how to do this on MSDN: How to display a gradient fill. I copied the GradientFill class and the Win32Helper class into my project, I didn’t bother using the GradientFilledButton class since I only needed gradient for my background.

Then I override the OnPaintBackground in my Screen, giving me this Form:

using System.Drawing;
using System.Windows.Forms;

Continue reading »

Tagged with:
Subscribe to my feeds Follow me on Twitter
DZone MVB