C#gdi Drawing

Source: Internet
Author: User

C#gdi Drawing

1. Drawing steps

1.1 Creating a Graphics class

The OnPaint() method parameter of the 1.1.1 control class PaintEventArgs gets the Graphcis object.

1.1.2 The creatgraphics() method in the form class or control to get the Graphics object.

1.1.3 produces a graphics object from a Bitmap object (Bitmap).

Common methods for 1.1.4Graphics classes:

Dispos: Releasing all resources used by the graphics

DrawEllipse: Drawing an ellipse

DrawArc: Drawing arcs

DrawLine: Drawing Lines

DrawPolygon: Drawing polygons

DrawRectangle: Drawing rectangles

Drawpie: Drawing an ellipse

Drawcurse: Drawing Curves

FillEllipse: Fills the interior of an ellipse

FillRegion: Fills the interior of region

ScaleTransform: The specified zoom operation is applied with the graphics

TranslateTransform: Panning changes the origin of the coordinate system

1.2 Creating Brushes Pen Class Object

Pen p = new Pen (color.red);

1.3 Creating a Brush class object

SolidBrush B = new SolidBrush (color.white);

The brush class is used to populate graphics and is an abstract class, so it cannot be instantiated directly. Therefore, you need to set the style of the brush through derived classes.

ImageBrush: Drawing Area

Linegradientbrush: Linear gradient drawing Area

RadialGradientBrush: Radial gradient drawing area, focus defines the beginning of the gradient, the ellipse defines the end of the gradient

SolidColorBrush: Monochrome Paint Area

VideoBrush: Video content drawing area

1.4 Creating a Font class

Font f = new Font ("script", 24,fontstyle.italic);

C#gdi Drawing

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.