Using CSharp forms with GDI
Using CSharp forms with GDI is fun and creativity . That sort creativity should be learned by the developer of graphic area. But programming has no limit. You have to excel in every aspect of programming. But don’t worry, pracice makes a man perfect
The required class for GDI is System.Drawing.Graphics class and it has the large number of methods to do the drawing.It is infact a large pool of drawing.
The Pen object
This helps us like a normal pen.It can draw many shapes that a normal pn can draw.
You can change many attributes such as color,thickness etc with the pen object
A brush is derived from System.Drawing.Brush. This is mainly used for filling the objects such as circles. After using this, you become virtual painter 🙂
Bitmaps and Images
System.Drawing.Image is the abstract class and many GDI+ methods use this. However it is abstract and has two descendants- Bitmap (System.Drawing.Bitmap) and MetaFile
GDI+ class has the methods that can make a drawing opaque as well per requirement.
GDI+ let us use text as well . You can draw text using any pen, color or brush, and in any font installed on your PC.
A simple example will demonstrate this
protected override void Painting(PaintEventArgs paint)
Graphics myGraphics = paint.Graphics ;
Rectangle r = new Rectangle(50, 30, 100, 100);
LinearGradientBrush lBrush = new LinearGradientBrush(r, Color.Red, Color.Yellow, LinearGradientMode.BackwardDiagonal);
Run it an see it