Tag Archives: transparency

Make a tool that creates PNG files with transparent backgrounds in C#

When you use the File menu’s Open command, the following code lets you select a image file. // The image. private Bitmap Bm = null; // Offset for displaying the image. private const int Offset = 10; // Open a … Continue reading

Posted in graphics, image processing | Tagged , , , , , , , , , , , , , | Leave a comment

Give an image a transparent background in C#

The Bitmap class’s MakeTransparent method changes all of the pixels with a given color to the transparent color A = 0, R = 0, G = 0, B = 0. When the program starts, the following code makes the background … Continue reading

Posted in graphics, image processing | Tagged , , , , , , , , , , , , | Leave a comment

Make a Region from non-transparent pixels in C#

The example Make shaped PictureBoxes in C# sets the Region property of two PictureBox controls to circular regions. That works well in that example where the images are round volleyballs with transparent backgrounds, but it would be hard to manually … Continue reading

Posted in algorithms, geometry, graphics, image processing | Tagged , , , , , , , , , , , , , | Leave a comment

Scale images and save them in C#

Occasionally when I’m writing a book or article, I need to scale images and then save them. MS Paint does this easily, but it loses any transparency information when it saves images. This program lets you scale images and then … Continue reading

Posted in drawing, graphics, image processing | Tagged , , , , , , , , , , , , | 1 Comment

Make a form fade out until it disappears in C#, Part 2

The example Make a form fade out until it disappears in C# makes a form fade out when the user clicks the form’s Close button, but there are several other ways the user can close the form without it fading … Continue reading

Posted in forms, user interface | Tagged , , , , , , , , , , , , | Leave a comment

Make a form fade out until it disappears in C#

Normally when you close a form it disappears. This example shows how you can provide a different effect by making the form fade out until it vanishes. (Like a ghost or a politician’s promises after election day.) A form’s Opacity … Continue reading

Posted in forms, user interface | Tagged , , , , , , , , , , , | 1 Comment

Remove part of an image in C#

This example lets you remove part of an image. It lets you load an image file and then click and drag to select an area on the image. When you release the mouse, the program generates two new images: an … Continue reading

Posted in algorithms, geometry, graphics, mathematics | Tagged , , , , , , , , , , , , | Leave a comment