Browse DevX
Sign up for e-mail newsletters from DevX


Don't Be Square: Creating Non-Rectangular Windows with .NET : Page 2

If you're tired of the same old rectangular boring user interfaces in your Windows programs and prefer the funky shapes of applications such as Windows Media Player 9, follow this step-by-step guide to take your applications where they have never been before.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

Getting Started
Figure 2. Mask Image: This wooden mask image defines the outline of the non-rectangular sample form.
To create a non-rectangular form, you need to create a mask that defines the outline shape of the form. You can use any image editing application to create the mask. I used the GIMP (GNU Image Manipulation Program), which is a superb open source image processing application. Figure 2 shows the mask used in the sample application. You can use this one, or create your own. It's important to realize that the mask picture itself is rectangular in shape. The mask image for this form, for example, is a rectangle with a white background; the parts of the background that are white now will become transparent later, when Windows draws the form, giving the impression that the form based on this picture is non rectangular.

Figure 3. Avoid Transparent Mask Images: The ugly transparency problems in the figure are caused by trying to use this compressed JPEG image as the background mask for the form.
Avoid using compressed images, such as JPEGs for the mask, because the compression leaves small artifacts in the background, which—when you try to make it transparent—tend to show up in a very ugly way. Figure 3 shows an example; you can see the jagged corners and edges caused by the compression, because those pixels are no longer 'pure' white, which is the color that the application was programmed to treat as transparent. You'll see more on that in the next section.

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date