Graphics+Class

=__Graphics Class and Objects (pg 290-293)__=

Objects from the Graphics class come from the System::Drawing namespace.

Common examples: Drawing::Brush - used to fill with a solid color Drawing::Rectangle - can provide location and boundaries for actual drawing Drawing::Graphics - (usually declared as "g") uses brush to draw a picture

Objects are derived types - Delcared using ^ symbol (Drawing::Graphics^ g;)

Process to create a circle inside a rectangle

1. Declare a Drawing::Brush object and Drawing::Graphics objects as instance objects 2. Initialize brush and graphics objects under Form1_Load (graphics object assigned to a pictureBox control) 3. Under the btn_Click event handler, declare Drawing::Rectangle object with dimensions as parameters 4. Use the FillEllipse method assigned to the graphics object, using the brush and rectangle as parameters