Capturing Screen as Bitmap Image in C#

The easiest way for taking screen snapshot in C# is given in the following code.

            Rectangle workingArea = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea;
            Bitmap screenShot = new Bitmap(workingArea.Width, workingArea.Height);

            Graphics gr = Graphics.FromImage(screenShot);

            gr.CopyFromScreen(0, 0, 0, 0, workingArea.Size);

            return screenShot;

In the above code, first a rectangle is created which equal to the size of the primary screen.
Then a bitmap is created which will store the pixels for the snapshot image.
The Graphics object is created which will store and perform operations on the bitmap object we just created.
The CopyFromScreen function captures the screen, copying all the color pixels to the bitmap of the Graphics object. The parameters to the function are about from where the copying will start in the source and to where it will go in the target. The first two are x and y are starting coordinates for the source and the third and fourth are about the starting coordinates for the target location. The last parameter is about the size of the rectangular region which will be copied, which consist of width and height.

Some Game of Life Animations

The following are some beautiful game of life animations, which i generated with an easy to use program, develped by me in C#.Net 2008.

The program is much easier to use but much slower as well. I am working on it to optimize it in performance and usability.
That will be available on net very soon.

DataSet as a DataBase

Using a DataSet as a database and store that directly on desk. Before storage, some encryption and compression can also be made. The whole process can be optimized to reduce desk accesses and RAM usage. A DataSet can be managed to be stored in more than one file, each once containing a distinct set of tables. The tables can be grouped in files to reduce desk accesses and Ram consumption.

DataReader as a DataSource

DataReader can be used as a data source to a control, so no need of while loop for getting for getting data into a control.