1 / 13

Drawing Operations

Drawing Operations. NameSpaces : System.Drawing System.Drawing.Drawing2D. Color. Used for representing color There are two ways to create color object RGB values Color c = Color.FromArgb(100, 100, 255); Predefined Colors Color c1 = Color.LavenderBlush; . Graphics Class.

ashtyn
Download Presentation

Drawing Operations

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Drawing Operations NameSpaces : System.Drawing System.Drawing.Drawing2D

  2. Color • Used for representing color • There are two ways to create color object • RGB values • Color c = Color.FromArgb(100, 100, 255); • Predefined Colors • Color c1 = Color.LavenderBlush;

  3. Graphics Class • Using for drawing a surface. • There are two ways to obtain graphics object • In Paint event handler • In other functions

  4. Graphics Class Functions • DrawCurve • DrawEllipse • DrawImage • DrawPath • DrawPolygon • DrawRectangle • DrawString • FillEllipse • FillPath • FillRectangle

  5. Point Structure • Represents a point • Used in some functions or structures to represent a location • Definition example Point p = new Point(2, 1); • Point (0,0) is upper-left corner of the form Point (0,0)

  6. Pen Class • Used for drawing lines, arcs and shapes. • Simple usage;

  7. Pen Class - Properties • Color : Color for pen. • Width : Width of the pen. • DashStyle: Style of dashed lines. • StartCap – EndCap : Cap style used in start and end of the line. • LineJoin : ıntersection style of consecutive lines (smooth, sharp)

  8. Pen Class – Color & Width Properties

  9. Pen Class – DashStyle • Line drawing style

  10. Pen Class – LineJoin & LineCaps Edges are smooth

  11. Brush Class • Used for painting graphical objects.

  12. LinearGradientBrush • Used for drawing object in desired pattern.

  13. Exercise • Write a drawing program that is used with mouse movements. • Let there be an option of picking color. • Let there be an option of picking line width.

More Related