Click here to Skip to main content
12,695,076 members (29,530 online)
Click here to Skip to main content
Add your own
alternative version

Stats

55.3K views
2K downloads
67 bookmarked
Posted

Magic Graphics

, 29 Oct 2008 CPOL
Rate this:
Please Sign up or sign in to vote.
A library that lets you easily manipulate your drawings
Screenshot - MG.gif

Introduction

Have you ever wanted to move a specific part of your drawing in GDI+ and had to redraw the whole scene again?
With this library, you'll be manipulating your drawings as if they were alive!

Background

To be able to use this class, you only have to know a little bit about GDI+ in VB .NET or C#.

About Magic Graphics Project

This project was designed and developed by Abd Allah Diab; the project is designed to make drawing in .NET applications easier.

Moving shapes in a scene was very hard because you had to redraw the whole scene again with the shape in its new location, redrawing is a huge problem when you have to remember each shape's position and colors and so, rotating and scaling was also very hard.

Using this class, you can now easily move, rotate or scale your shapes by writing a single line, assume that r is a rectangle:

r.Move(New X, New Y)

The Structure of Magic Graphics

The namespace consists of:

  1. IShape (any shape Interface)
  2. Shape (base class for any shape)
  3. ShapeContainer (a class that holds the shapes in it so you can draw, move, rotate and scale without redrawing the whole scene)
  4. Ellipse, Rectangle and Lines (predefined shapes that you can use in your application)

IShape Structure

a. Methods

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: black 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; WIDTH: 78pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Name

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: black 1pt solid; PADDING-LEFT: 5.4pt; FONT-SIZE: 11pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 104pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; FONT-FAMILY: Arial; BACKGROUND-COLOR: transparent" valign=removed">

Parameters

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: black 1pt solid; PADDING-LEFT: 5.4pt; FONT-SIZE: 11pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 381pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; FONT-FAMILY: Arial; BACKGROUND-COLOR: transparent" valign=removed">

Description

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; WIDTH: 78pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Move

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 104pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

X,Y: Integer

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 381pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Moves the shape to the given X,Y.

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; WIDTH: 78pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Rotate

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 104pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Angle: Single Float

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 381pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Rotates the shape with the given angle in degrees.

Adds the given angle to the previous angle.

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; WIDTH: 78pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 21px; BACKGROUND-COLOR: transparent" valign=removed">

Scale

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 104pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 21px; BACKGROUND-COLOR: transparent" valign=removed">

Dx, Dy: Single Float

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 381pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 21px; BACKGROUND-COLOR: transparent" valign=removed">

Scales the shape with the given dx, dy.

Multiplies its height by dy, and its width by dx.

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; WIDTH: 78pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

ResetRotation

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 104pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

-

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 381pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Resets the rotation of the shape to 0.

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; WIDTH: 78pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

ResetScale

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 104pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

-

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 381pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Resets the scale of the shape to its original scale.

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; WIDTH: 78pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Render

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 104pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

-

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 381pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Draws the shape in its location and its rotation and scale in its container.

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; WIDTH: 78pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

ToString

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 104pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

-

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 381pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Returns a string that describes the shape.

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; WIDTH: 78pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

SetContainer

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 104pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Container:ShapeContainer

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 381pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Sets the container of the shape so the shape will be drawin in it.

b. Properties

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: black 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; WIDTH: 41pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Name

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: black 1pt solid; PADDING-LEFT: 5.4pt; FONT-SIZE: 11pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 25pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; FONT-FAMILY: Arial; BACKGROUND-COLOR: transparent" valign=removed">

Read Only

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: black 1pt solid; PADDING-LEFT: 5.4pt; FONT-SIZE: 11pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 61pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; FONT-FAMILY: Arial; BACKGROUND-COLOR: transparent" valign=removed">

Type

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: black 1pt solid; PADDING-LEFT: 5.4pt; FONT-SIZE: 11pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 224pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; FONT-FAMILY: Arial; BACKGROUND-COLOR: transparent" valign=removed">

Description

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; WIDTH: 41pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Center

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 25pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

No

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 61pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

System.Drawing.Point

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 224pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Gets or sets the center point of the shape that it will rotate at.

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; WIDTH: 41pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Location

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 25pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Yes

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 61pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

System.Drawing.Point

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 224pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Gets the current location of the shape, and can be changed using Move method.

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; WIDTH: 41pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Height

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 25pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

No

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 61pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Integer

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 224pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Gets or sets the height of the shape without scaling it.

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; WIDTH: 41pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Width

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 25pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

No

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 61pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Integer

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 224pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Gets or sets the width of the shape without scaling it.

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; WIDTH: 41pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Rotation

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 25pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Yes

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 61pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Single Float

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 224pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Gets the current rotation of the shape according to its original state in degrees.

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; WIDTH: 41pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

ScaleX

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 25pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Yes

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 61pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Single Float

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 224pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Gets the current scale on X of the shape according to its original state.

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; WIDTH: 41pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

ScaleY

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 25pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Yes

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 61pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Single Float

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 224pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Gets the current scale on Y of the shape according to its original state.

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; WIDTH: 41pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Container

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 25pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Yes

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 61pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

ShapeContainer

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 224pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Gets the shape container of the shape.

Shape Structure

The Shape class implements the IShape interface, but it has a Dispose method that accepts a Boolean value as a parameter that indicates whether to remove the shape from the container or not.

ShapeContainer Structure

a. Methods

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: black 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; WIDTH: 0.86in; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Name

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: black 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 191pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Parameters

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: black 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 304pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Description

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; WIDTH: 0.86in; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

New

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; FONT-SIZE: 11pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 191pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; FONT-FAMILY: Arial; BACKGROUND-COLOR: transparent" valign=removed">

Graphics: System.Drawing.Graphics

Width, Height: Integer

BackgroundColor: System.Drawing.Color

vBMP(Optional): System.Drawing.Bitmap

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; FONT-SIZE: 11pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 304pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; FONT-FAMILY: Arial; BACKGROUND-COLOR: transparent" valign=removed">

Constructor that builds a new instance of ShapeContainer that will draw in Graphics using the Width, Height and BackgroundColor to draw, then will put the whole drawing in vBMP if was passed, if vBMP is nothing then the class will draw in its own Bitmap.

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; WIDTH: 0.86in; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

AddShape

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 191pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Shp: Shape

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 304pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Adds the passed shape to the container.

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; WIDTH: 0.86in; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Clear

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 191pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

-

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 304pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Clears the ShapeContainer from shapes.

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; WIDTH: 0.86in; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Flush

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 191pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

-

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 304pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Draws the result in the Graphics object that was passed in the constructor.

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; WIDTH: 0.86in; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

RemoveShape

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 191pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Shp: Shape

OR

Index: Integer

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 304pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Removes the shape at the passed Index or removes the shape passed to it if it was found in it.

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; WIDTH: 0.86in; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Render

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 191pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Flush(Optional): Boolean

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 304pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Redraws the whole scene again and saves it in the bitmap, if Flush is True then the bitmap will be drawn in the Graphics object.

b. Properties

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: black 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; WIDTH: 49pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Name

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: black 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 203pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Type

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: black 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 327pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Description

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; WIDTH: 49pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

AutoFlush

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 203pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Boolean

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 327pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

If true then the Render method will always have Flush set to True.

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; WIDTH: 49pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Graphics

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 203pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

System.Drawing.Graphics (ReadOnly)

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 327pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Gets the graphics object that was passed to the constructor.

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; WIDTH: 49pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Shape

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 203pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Shape(ReadOnly, Default)

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 327pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Gets the shape at a specified index.

c. Fields

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: black 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; WIDTH: 41pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 21px; BACKGROUND-COLOR: transparent" valign=removed">

Name

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: black 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 141.35pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 21px; BACKGROUND-COLOR: transparent" valign=removed" width="188">

Type

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: black 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 212pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 21px; BACKGROUND-COLOR: transparent" valign=removed">

Description

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; WIDTH: 41pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

BMP

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 141.35pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed" width="188">

System.Drawing.Bitmap

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 212pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Gets the Bitmap object that the scene will be rendered in.

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; WIDTH: 41pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

ShapesL

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 141.35pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed" width="188">

List(Of Shape)

<td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: rgb(244,244,244); PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: rgb(244,244,244); WIDTH: 212pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent" valign=removed">

Gets the shapes list in this container.

Implementing Magic Graphics in your Application

Here's an example that shows how to draw an Ellipse and a Rectangle using Magic Graphics class:

Imports System.Drawing
Imports System.Drawing.Drawing2D
' Create a Form and put a PictureBox on it,
' and put a Button to draw an ellipse and another to draw a rectangle.
' Now let's add a Timer to move and rotate, Timer1 (Interval = 100; Enabled = True).
Public Class FormMain
    Dim SC As MagicGraphics.ShapeContainer
    Private Sub FormMain_Load(ByVal sender As System.Object, _
        ByVal e As System.EventArgs) Handles MyBase.Load
        SC = New MagicGraphics.ShapeContainer(PictureBox1.CreateGraphics, _
        PictureBox1.Width, PictureBox1.Height, Color.Black)
        PictureBox1.Image = SC.BMP
        SC.AutoFlush = False
    End Sub

    Private Sub ButtonRectangle_Click(ByVal sender As System.Object, _
        ByVal e As System.EventArgs) Handles Button1.Click
        Dim Sq As New MagicGraphics.Rectangle(New Pen(Color.Black, 3), _
                Brushes.Aqua, 60, 20, 50, 50)
        Sq.FillingBrush = New Drawing2D.LinearGradientBrush(New Point(0, 0), _
            New Point(60, 0), Color.Yellow, Color.Red)
        SC.AddShape(Sq)
        'From here you can easily manipulate this Rectangle by refering to Sq.
    End Sub

    Private Sub ButtonEllipse_Click(ByVal sender As System.Object, _
        ByVal e As System.EventArgs) Handles Button1.Click
        Dim El As New MagicGraphics.Ellipse(New Pen(Color.Black, 3), _
                Brushes.Olive, 60, 88, 50, 71)
        El.FillingBrush = New Drawing2D.LinearGradientBrush(New Point(0, 0), _
            New Point(30, 0), Color.Red , Color.SteelBlue)
        SC.AddShape(El)
        'From here you can easily manipulate this Ellipse by refering to El.
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, _
        ByVal e As System.EventArgs) Handles Timer1.Tick
        If SC.ShapesL.Count = 0 Then Exit Sub
        For Each shp As MagicGraphics.Shape In SC.ShapesL
            shp.Rotate(10) 'Rotates every shape in this container by 10 degrees.
            shp.Move(shp.Location.X + 1, shp.Location.Y + 1) 'Offsets every shape
    ' in this container by 1 pixel on X axis, and 1 pixel on Y axis.
        Next
    End Sub
End Class

The result must be something that looks like the picture above.

Custom Shapes

This class lets you design your own shapes by inheriting the base class Shape. You must write the Render sub (void) and the ToString function. You can add properties, events and other things to your shapes and have a great library of your own shapes.

Summary

This class, as you've seen, is very easy to implement and use, and it really saves a lot of time in redrawing.

Have fun and happy drawing.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Abd Allah Diab
United Arab Emirates United Arab Emirates
No Biography provided

You may also be interested in...

Comments and Discussions

 
Question'MagicGraphics.ShapeContainer' is not defined Pin
Member 969025629-Apr-15 6:43
memberMember 969025629-Apr-15 6:43 
QuestionSource Code and Demo Application ?!? Pin
Tefik Becirovic22-Oct-08 5:27
memberTefik Becirovic22-Oct-08 5:27 
AnswerRe: Source Code and Demo Application ?!? Pin
Magic PC22-Oct-08 8:13
memberMagic PC22-Oct-08 8:13 
AnswerRe: Source Code and Demo Application ?!? Pin
Magic PC29-Oct-08 6:59
memberMagic PC29-Oct-08 6:59 
GeneralWhy does Move(x,y) make a copy Pin
Dan Demp20-Jul-07 18:52
memberDan Demp20-Jul-07 18:52 
GeneralRe: Why does Move(x,y) make a copy Pin
Magic PC21-Jul-07 1:53
memberMagic PC21-Jul-07 1:53 
QuestionWhat am I doing wrong? Pin
Bruce Robinson21-Jun-07 7:41
memberBruce Robinson21-Jun-07 7:41 
AnswerRe: What am I doing wrong? Pin
Magic PC21-Jun-07 9:35
memberMagic PC21-Jun-07 9:35 
GeneralRe: What am I doing wrong? Pin
Bruce Robinson21-Jun-07 9:50
memberBruce Robinson21-Jun-07 9:50 
GeneralRe: What am I doing wrong? Pin
Magic PC23-Jun-07 2:03
memberMagic PC23-Jun-07 2:03 
GeneralWhere's the source.... Pin
Gary Noble20-Jun-07 4:25
memberGary Noble20-Jun-07 4:25 
GeneralRe: Where's the source.... Pin
Magic PC20-Jun-07 7:03
memberMagic PC20-Jun-07 7:03 
QuestionSource Code Missing Pin
Pushaw19-Jun-07 4:27
memberPushaw19-Jun-07 4:27 
GeneralNicely Done Pin
merlin98115-Jun-07 4:10
membermerlin98115-Jun-07 4:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170118.1 | Last Updated 29 Oct 2008
Article Copyright 2007 by Abd Allah Diab
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid