Download the project, including the source (126 kb)
Sometimes a certain piece of code is so general that you want to bottle it and sell it to everyone.
In this case we have a piece of code that I normally apply to all the forms that I create in VS.NET.
I figure that every form can use a built-in ability to do the following:
- Change the priority of the application
- Change the transparency (known as opacity) of the form
- Minimize the form to the tray
- Take a screenshot of the form and place the file on the desktop
- Set the form to always be on top
So how do you apply this code to your forms? That's the cool part and this is what makes inheritance
so powerful. Here is a short step by step tutorial (it assumes you have downloaded the project).
- In your project, add FormSysMenuValueAdd.dll to your references. You'll find it in Library/bin folder
- Now put your form into View Code mode and scroll to the very top. There you will see code like this:
Public Class Form1
Inherits System.Windows.Forms.Form
Change it to the following:
Public Class Form1
Inherits FormSysMenuValueAdd.MasterForm
Yep, that's it. When you run your now, it will have all the extra features sitting in the system menu.
Note: I can't take credit for the screenshot code, I downloaded it somewhere, I don't know where.
Download the project, including the source (126 kb)