Polar Draw - New Object Model

Polar Draw version 2.0 brings you a completely new organization of properties, methods and events. When you import the Polar Draw ActiveX control into your project, you will 'see' only the main, global object: PolarDRAW. Unlike before, you can not retrieve information about the page, shapes, selection, and guidelines from the PolarDraw object… Now you must define each of them from the main object and the retrieve the information that you want.

The New object model is represented here and if you want a quick overview of how to get each object here, see Retrieving Objects topic.

For example:

If you want to retrieve the color fill of the shape given by its ID, you must follow these steps:

color = PolarDRAW.ActivePage.Shapes(ID).Fill.Color

Sounds complicated? Now when we consider that you are dealing with shapes on the active page through the whole project, we can do the same like this:

Public pd_Shapes As POLARDRAW20Lib.Shapes
color = pd_Shapes(ID).Fill.Color


Introduction

Objects	Technical Support

Welcome to the Polar Draw ActiveX control Help.

Developing software is an expensive and time-consuming endeavor. This is especially true for software that requires interactive graphics with a drag-and-drop functionality. This type of application must give the user the ability to view and interact with symbolic or visual representations of data. Developing this kind of software on a Windows platform generally entails working with the complex, low-level Windows Graphics Device Interface. The remedy to this situation is a flexible tool that helps developers to create interactive, visual applications that are reliable and affordable.

Polar Draw ActiveX control will improve your application by giving it the functionality of drawing. It enables you to add to your application possibilities of drawing, editing and formatting shapes.

This Help provides a functional and technical overview of Polar Draw ActiveX control. It discusses the features and technical highlights of Polar Draw ActiveX control.

We encourage you to explore the product features with the Polar Draw ActiveX control demos available at http://www.polarsoftware.com.


Technical support

If you need help using Polar Draw ActiveX control, contact Polar in any of the following ways:

•	visit our home page at	www.polarsoftware.com.

•	E-mail:	support@polarsoftware.com	or

info@polarsoftware.com.


Page

The page is the portion of the canvas that will appear on the printed page. This area is enclosed by a rectangle with a shadow effect below it and to its right (optional). Although you can draw anywhere in the canvas, only shapes on the Page appear in your print jobs.


Canvas

The canvas is a drawing surface for visual shapes. Most importantly, it handles user interaction such as adding, deleting, moving, scaling, and rotating shapes. The canvas also manages undo/redo, zooming, scrolling, snap to grid, snap to guidelines, OLE drag-and-drop, and many other features.


Viewport

The viewport is the visible portion of the canvas. You can set canvas dimensions to fit the viewport (in that case you will not need scroll bars).


Open path

A line or curve  whose start and end points are not connected. You can apply color changing, filling or adding arrows to an Open path.


CMYK

A subtractive color model made up of cyan (C), magenta (M), yellow (Y), and black (K). A subtractive color model produces color when light is reflected off an object or surface. The reflected light determines the color that is seen when that object is viewed. For example, a perfectly white surface reflects all wavelengths of light. A black surface absorbs all wavelengths.

The CMYK color model is used in most full-color commercial printing.


Polar Draw Constants

About…	Objects

Appearance

Border Style

Edit Mode

Shape type

Polygon type

Measurement Units

Shadow

Lens

Fill

Line

Arrows

FitTo constants

Object Types

Routing types

ZOrder constants

Appearance

polAppearance	Description

ccFlat = 0	Paints control and forms without visual effects.

cc3D = 1	Paints control with three-dimensional effects.

BorderStyle

Constant	Description

ccNone = 0	(Default) No border or border-related elements.

ccFixedSingle = 1	Fixed single.

Polygon Type

polPolygonType	Description

polCurvePoly = 1	Curve

polFreeformPoly = 2	Freeform

polScribblePoly = 3	Scribble

Shape Type

polShapeType	Description

polFreeform = 0	One of the Freeform polygons (look at CurrentPolygonType )

polRectangle = 1	Rectangle

polRoundRectangle = 2	Rectangle with rounded corners

polEllipse = 3	Ellipse

polDiamond = 4	Diamond

polIsoscelesTriangle = 5	Triangle

polRightTriangle = 6	Right triangle

polParallelogram = 7	Parallelogram

polTrapezoid = 8	Trapezoid

polHexagon = 9	Hexagon

polOctagon = 10	Octagon

polPlusSign = 11	Plus Sign (Cross)

polStar = 12	Star

polArc = 19	Arc

polLine = 20	Line

polPentagon = 56	Pentagon

polLeftArrow = 66	Left arrow

polPlainText = 136	Text

polTextBox = 202	Text box

polLink = 10000	Link (freeform shape that defines the connection between two other shapes)

polDimensionBar = 10250	Dimension bar

Edit mode

polEditMode	Description

polResize = 1	Activates the resize mode.

polRotate = 2	Activates the rotation mode.

polEditPoints = 3	Activates the mode for editing points.

polCreateNew = 4	Enables the creation of a new shape. Its type is defined by the CurrentShapeType  property.

polView = 6	The mode in which any end-user interaction is disabled. It is useful just for previewing the picture.

Measurement units

polMeasurementUnits	Description

polUnitsHimetric = 0	Measurement Unit: 0.01 mm

polUnitsMilimeter = 1	Measurement Unit: 1 mm

polUnitsCentimeter = 2	Measurement Unit: 10 mm

polUnitsTwips = 3	Measurement Unit: 1 twips = 1/1440 inch

polUnitsHienglish = 4	Measurement Unit: 0.001 inch

polUnitsInch = 5	Measurement Unit: 1 inch

polUnitsPoint = 6	Measurement Unit: 1 point = 1/72 inch

polUnitsPica = 7	Measurement Unit: 1 pica = 12 points = 1/6 inch

polUnitsPixel = 8	Measurement Unit: 1 pixel

Object Types

polObjectType	Description

polDrawControlObject = 1	Main Polar Draw object.

polPageObject = 12	Page object

polShapesObject = 13	Shapes collection

polShapeObject = 14	Shape object

polFillObject = 15	Fill object

polGuidelinesObject = 16	Guidelines collection

polGuidelineObject = 17	Guideline object

polSelectionObject = 18	Selection object

polShapeRangeObject = 19	ShapeRange collection

polLineObject = 21	Line object

polArrowsObject = 22	Arrows object

polLensObject = 23	Lens object

polShadowObject = 24	Shadow object

polTextObject = 25	Text object

polConnectionObject = 28	Connection object

polLockObject = 29	Lock object

polFontObject = 30	Font object

polVerticesObject = 32	Vertices collection

polVertexObject = 33	Vertex object

polHyperlinkObject = 35	Hyperlink object

polWindowObject = 36	Window object

polEnvironmentObject = 37	Environment object

Shadow

polShadowType	Description

polOffShadow = 0	Single offset shadow

polDoubleOffShadow = 1	Double offset shadow

polEmboss = 5	Emboss shadow

Lens

polLensType	Description

polBrighten = 0	A Brighten lens adds brightness or darkness to the objects underneath it. The percentage value controls the amount of brightness or darkness created by the lens. The range of 0 to 100% increases the level of brightness while the range of 0 to -100% increases the level of darkness. You will find the Brighten lens particularly effective for applying brightness or darkness to a bitmap image.

polColorAdd = 1	When you create a Color Add lens, the colors of the objects beneath the lens are added to the color of the lens as if you were mixing colors of light. The Lens Percent value controls the extent of the color addition. A rate of 0% results in no color addition and the lens appears to have no fill. A rate of 100% defines maximum color addition. Because white light contains all the colors of the spectrum, creating a colored lens and placing it over a white object or a white page turns the lens white. Adding a color to white light produces white light. To see the effects, the background or object beneath the lens can not be white.

polColorLimit = 2	A Color Limit lens works much like a color filter lens on a camera, allowing only black and the lens color itself to show through. White and light colors in objects beneath the lens are converted to the lens color. For example, if you place a green Color Limit lens over a bitmap, all colors except green and black are filtered out within the lens area. (Parameters: Lens Percent [0,100], Lens color)

polCustomPalette = 3	The Custom Color Map lens sets all underlying colors to a color range between any two colors you select. In addition to defining the range's start and end colors, you choose the route or progression between the colors.

polInvert = 6	An Invert lens causes all the colors underneath it to appear as their complementary CMYK color. Complementary colors are colors that appear opposite one another on the color wheel. For example, when an Invert lens is applied to a photo bitmap, the result simulates a photographic negative.

polTintedGrayscale = 8	TintedGrayscale: The Tinted Grayscale lens changes the colors of objects underneath it to their grayscale equivalents. The lens color becomes the darkest color in any object under it. All other colors in the object become lighter shades of the lens's color. You'll find Tinted Grayscale lenses particularly effective for creating sepia-tone effects. For example, if you place a brown grayscale lens over a color photograph, the photograph takes on a sepia-tone look. You can also turn a color photograph into a black-and-white photograph by placing a black grayscale lens over it. (Parameter: Lens color)

polHeatmapPalette = 5	The Heat Map lens creates the effect of an infrared image. This lens uses a limited Color Palette of white, yellow, orange, red, blue, violet, and cyan to illustrate the "heat" levels of colors in objects underneath it. Hot colors beneath the lens appear as red or orange, while cool colors appear violet or cyan.

polTransparency = 9	Transparency: the shape takes on the appearance of a piece of tinted plastic film or glass. A transparent lens can be any color. When you place the lens over other objects, these objects take on the lens tint. The Rate setting controls the lens' level of transparency. Rates closer to 100% are more transparent while those closer to 0% are more opaque.

Fill

polFillType	Description

polSolidColor = 0	The shape will be filled with the solid color. The color can be set with one of the Fill Color methods.

polPattern = 1	The shape will be filled with the predefined pattern. Pattern can be set with the FillPattern method, or with PatternDlg_Method method which will invoke a dialog-box with pattern samples.

polTexture = 2	The shape can be filled with the predefined texture or one of the graphical files from your disk. More…

polPicture = 3	The shape will be filled with one of the graphical files from your disk. More…

polShade = 7	The shape will be shaded with the color palette defined with Fill Color and FillBackColor as start and end colors and the FillAngle. See also GradientDlg .

polPatterns	Description

pol5Percent = 1	5%

pol50Percent = 2	50%

polLightDownwardDiagonal = 3	Light downward diagonal

polLightVertical = 4	Light vertical

polDashedDownwardDiagonal = 5	Dashed downward diagonal

polZigZag = 6	ZigZag

polDivot = 7	Divot

polSmallGrid = 8	Small grid

pol10Percent = 9	10%

pol60Percent = 10	60%

polLightUpwardDiagonal = 11	Light upward diagonal

polLightHorizontal = 12	Light horizontal

polDashedUpwardDiagonal = 13	Dashed upward diagonal

polWave = 14	Wave

polDottedGrid = 15	Dotted grid

polLargeGrid = 16	Large grid

pol20Percent = 17	20%

pol70Percent = 18	70%

polDarkDownwardDiagonal = 19	Dark downward diagonal

polNarrowVertical = 20	Narrow vertical

polDashedHorizontal = 21	Dashed horizontal

polDiagonalBrick = 22	Diagonal brick

polDottedDiamond = 23	Dotted diamond

polSmallCheckerBoard = 24	Small checker board

pol25Percent = 25	25%

pol75Percent = 26	75%

polDarkUpwardDiagonal = 27	Dark upward diagonal

polNarrowHorizontal = 28	Narrow horizontal

polDashedVertical = 29	Dashed vertical

polHorizontalBrick = 30	Horizontal brick

polShingle = 31	Shingle

polLargeCheckerBoard = 32	Large checker board

pol30Percent = 33	30%

pol80Percent = 34	80%

polWideDownwardDiagonal = 35	Wide downward diagonal

polDarkVertical = 36	Dark vertical

polSmallConfetti = 37	Small confetti

polWeave = 38	Weave

polTrellis = 39	Trellis

polOutlinedDiamond = 40	Outlined diamond

pol40Percent = 41	40%

pol90Percent = 42	90%

polWideUpwardDiagonal = 43	Wide upward diagonal

polDarkHorizontal = 44	Dark horizontal

polLargeConfetti = 45	Large confetti

polPlaid = 46	Plaid

polSphere = 47	Sphere

polSolidDiamond = 48	Solid diamond

polTextures	Description

polDrops = 1	Water Drops

polPaperbag = 2	Paperbag texture

polWood = 3	Wood surface

polFishFossil = 4	Fish fossil

polNewsprint = 5	Newsprint

polRecycledPaper = 6	Recycled paper

polParchment = 7	Parchment

polStationery = 8	Stationery

polGreenMarble = 9	Green marble

polWhiteMarble = 10	White marble

polBrownMarble = 11	Brown marble

polGranite = 12	Granite

polBlueTissuePaper = 13	Blue tissue paper

polPinkTissuePaper = 14	Pink tissue paper

polPurpleMesh = 15	Purple mesh

polBouquet = 16	Bouquet

polPapyrus = 17	Papyrus

polCanvas = 18	Canvas

polDenim = 19	Denim

polWovenMat = 20	Woven mat

polSand = 21	Sand

polCork = 22	Cork

polWalnut = 23	Walnut

polOak = 24	Oak

Line

polLineDash	Description

polSolid = 0	Solid line

polDot = 2	Dotted line

polShort_Dash = 6	Dashed line with short dashes

polShort_Dash_Dot = 7	Short dash - dot

polLong_Dash = 8	Dashed line with long dashes

polLong_Dash_Dot = 9	Long dash - dot

polDash_Dot_Dot = 10	Dash-dot-dot

Arrows

polArrowType	Description

polNothing = 0	No arrow

polSimpleArrow = 1	Simple

polStealthArrow = 2	Stealth

polDiamondArrow = 3	Diamond

polOvalArrow = 4	Oval

polOpenArrow = 5	Open

polArrowWidth	Description

polNarrowArrow = 0	Sets the narrow arrowhead.

polMediumArrowW = 1	Sets the medium arrowhead.

polWideArrow = 2	Sets the wide arrowhead.

polArrowLength	Description

polShortArrow = 0	Sets the short arrowhead

polMediumArrowL = 1	Sets the medium arrowhead

polLongArrow = 2	Sets the long arrowhead

FitTo constants

polFitType	Description

polFitToPage = 0	Adjusts the magnification so the paper height and width fit to the control's viewport dimensions.

polFitToSelection = 1	Adjusts the magnification sothe  current selection fis to the control's viewport dimensions.

polFitToWidth = 2	Adjusts the magnification so the paper width fits to the control's viewport dimensions.

polFitToHeight = 3	Adjusts the magnification so paper height fits to the control's viewport dimensions.

Routing types

polLinkType	Description

polDirectLink = 0	Direct connection. It connects the source port  to the destination port.

polManhattanLink = 1	Rectangular connection. It has only vertical and horizontal segments.

ZOrder constants

polZOrderCmd 	Description

polSendToBack = 0	Moves the object directly to the bottom of the stack.

polSendBackward = 1	Moves the object one place in the direction of the bottom of the stack.

polBringForward = 2	Moves the object one place in the direction of the top of the stack.

polBringToFront = 3	Moves the object directly to the top of the stack.


About Polar Draw coordinate system

About…	Objects

When you insert the Polar Draw ActiveX Control in a dialog resource as a child control, you will get a simple picture box that contains rulers, scroll bars, a canvas and the page. In Polar Draw, the visual components (shapes) are drawn and manipulated on a canvas. Lines, polygons, ellipses and text are examples of shapes.

Canvas

The canvas is a drawing surface for visual shapes. Most importantly, it handles user interaction such as adding, deleting, moving, scaling, and rotating shapes. The canvas also manages undo/redo, zooming, scrolling, snap to grid, snap to guidelines and many other features.

Page

The page is the portion of the canvas that will appear on the printed page. This area is enclosed by a rectangle with a shadow effect below it and to its right (optional). Although you can draw anywhere in the canvas, only shapes on the Page appear in your print jobs.

Polar Draw also enables you to choose the look of the canvas and page ( [image] color, shadow, outline, dimensions...).

Viewport

The viewport is the visible portion of the canvas. You can set the canvas dimensions to fit the viewport (in that case you won't need scroll bars).

The picture below shows Polar Draw coordinate system.

The picture shows 3 origins, but the main coordinate system is the one that refers to the page origin. Each shape manipulation (setting dimensions, rotation, translation...) refers to this coordinate system.

Origin	top-left corner of the page. Can be set (see OriginX and OriginY) or moved in respect to the canvas origin.

x-axis	top side of page; values rise from left to right

y-axis	left side of page, values rise from top to bottom

angle	minus (-) before an angle value to rotate the object clockwise; a positive value to rotate it counter-clockwise.

The Viewport origin is the top-left corner of the viewport. It can be set (see ViewportOriginX and ViewportOriginY) in respect to the canvas origin.

The Canvas origin is the top-left corner of the canvas. It cannot be moved and serves as a reference for setting the page and viewport origins.


Environment Properties

Environment properties are those properties that describe the  environment of the drawing (Paper and canvas color, grids and guidelines, which actions are allowed and which are not...). Group of environment properties consists of:

BackgroundColor

PaperColor

GridColor

GuidelineColor

PaperShadowColor

PaperOutlinecolor

DrawPaper

ShowPaperOutline

DrawPaperShadow

PaperShadowOffset

ShowVerticalScrollBar

ShowHorizontalScrollBar

ShowVerticalRuler

ShowHorizontalRuler

MeasurementUnits

AllowDragSelect

AllowSelect

AllowRotate

AllowDelete

AllowResize

AllowMove

AllowEditPoints

AllowDeletePoints

ShowSelection


Polygon

Polygon is:

•	any shape created when CurrentShapeType property is set to polFreeform,

•	added with the AddPolygon method,

•	or any other shape after ConvertToPolygon method is applied.


Polygon points
Polygon nodes

Polygon nodes are relative to the bounding box. The coordinates are plotted within the bounding box of the polygon. The bounding box is divided into 65536 units and scaled from 0 to 65535 for both the x and y dimensions. This means if we want to place one of the polygon nodes to the left-top corner of the bounding box, it will have the coordinates (0, 0), in the middle it will be (65535/2, 65535/s2) = (32768,32768), and in the right-bottom corner, the coordinates must be (65535,65535).

To make closed polygon, the first and last nodes must have the same coordinates.


What's new?

What's new in this version?

Completely new object model	Using Polar Draw is now easier than ever: - It's easier to find the function you need; - You can define the range of shapes and deal with it as with one simple shape - It's easier to iterate through all shapes or just range of shapes.
Linking	You can create connections between shapes, and that gives you the opportunity to use Polar Draw even as a charter! Two ways of linking shapes are offered: The Manhatten link and the Direct link.
Hyperlink	Adding a hyperlink attribute to a shape gives the PolarDraw drawing the ability to be dynamic. You can combine the hyperlink feature with the linking feature and create an application that will represent a dynamic web site map?!
Grouping/Ungrouping	Now you can create one shape as the combination of couple of other shapes.
ConvertToPolygon	This new feature allows you to edit autoshapes, or even Text!
Text	Now you can display text inside any shape and not only in the rectangle.


Retrieving Objects

To make your life easier, we made this table. Which object is used for what and how to retrieve it? Here it is:

Object	The way to get it	Description
Control	PolarDRAW	Global object.
Window	PolarDRAW.ActiveWindow	Window that contains current document
Environment	Window.Environment	Represents I/O characteristics of the Window object
Page	PolarDRAW.ActivePage	Active (current) page
	Window.Page	Page shown in the Window object
Guidelines	Page.HorGuidelines	Collection of horizontal guidelines
	Page.VertGuidelines	Collection of vertical guidelines
Guideline	Guidelines.Item	Specific guideline, specified with its position in the collection
Shapes	Page.Shapes	Collection of all shapes on the page
Selection	Page.Selection	Represents the current selection on the page. It does not represent shapes, because it is predicted that the selection will not contain only shapes in future versions. To retrieve the shapes from the selection, see the ShapeRange object
ShapeRange	Selection.ShapeRange	The range of all shapes that are currently selected. This object will represent the same shapes even if they are later deselected.
	Shapes.Range	Specific range of shapes. The range of shapes can be specified with an array of strings (shape names), an array of numbers (position of shape in z-order), or even with one string or one number if you are creating the ShapeRange of just one shape.
	Shape.Connections	The Connections property returns the ShapeRange collection object that contains all the shapes that represent a link between the shape this property is applied to and any other shape.
Shape	ShapeRange.Item	Represents just one shape among the shapes in the ShapeRange. The Shape is specified with its index (determined by its position in the z-order).
	Shapes.Item	Represents just one shape among all the shapes on the page. The Shape is specified with its index (determined by its position in the z-order)
	Shapes.ItemFromID	Represents just one shape among all the shapes on the page. The Shape is specified with its ID.
	Shapes.GetShapeOnPoint	This method returns the shape object that is at a specific location.
	Shapes.Add Shapes.AddText Shapes.AddPolygon Shapes.AddLine Shapes.AddPicture Shapes.AddPictureFromObj	This method returns the shape object that is currently created.
Fill	Shape.Fill	Describes shape's fill
	ShapeRange.Fill	Use this object if you want to set the filling style for the range of shapes. This object returns properties of just one shape and that is the shape with the lowest z-order position in this range.
Line	Shape.Line	Describesthe  shape's outline
	ShapeRange.Line	Use this object if you want to set the outline style for the range of shapes. This object returns the properties of just one shape and that is the shape with the lowest z-order position in this range.
Shadow	Shape.Shadow	Describes the shape's shadow
	ShapeRange.Shadow	Use this object if you want to set the shadow style for the range of shapes. This object returns properties of just one shape and that is the shape with the lowest z-order position in this range.
Lock	Shape.Lock	Describes the shape's lock properties
	ShapeRange.Lock	Use this object if you want to set the lock properties for the range of shapes. This object returns the properties of just one shape and that is the shape with the lowest z-order position in this range.
Arrows	Shape.Arrows	Describes the arrows that are applied to the shape
	ShapeRange.Arrows	Use this object if you want to se tthe  arrows style for the range of shapes. This object returns the properties of just one shape and that is the shape with the lowest z-order position in this range.
Text	Shape.Text	Describes the text displayed in shape
	ShapeRange.Text	Use this object if you want to set the text characteristics for the range of shapes. This object returns the  properties of just one shape, and that is the shape with the lowest z-order position in this range.
Connection	Shape.Connection	Describes the shape's connection properties if the shape is a link between two other shapes
Lens	Shape.Lens	Describes the lens effects applied to specific shape
	ShapeRange.Lens	Use this object if you want to set the lens effect style for the range of shapes. This object returns the properties of just one shape and that is the shape with the lowest z-order position in this range.
	Shadow.Lens	Describes the lens effects applied to the shadow of specific shape or range of shapes
Vertices	Shape.Vertices	This is a collection of polygon vertices ( if the shape is polygon).
Vertex	Vertices.Item	Represents the specific vertex in the vertices collection.
Hyperlink	Shape.Hyperlink	Describes the  Hyperlink characteristics of the specific shape
	ShapeRange.Hyperlink	Use this object if you want to set Hyperlink characteristics for the range of shapes. This object returns the properties of just one shape, and that is the shape with the lowest z-order position in this range.
Font	Text.Font	Defines  the font style of the text displayed in the shape object.
Graphical:


Control (Object)

See Also	Properties	Methods	Events

The Control global object is automatically available to IDE code when the Polar Draw ActiveX control is registered on your machine. It has its default name, but it can also be  changed.

Remarks

Members of the global object can be accessed this way:

PolarDraw.ActivePage	Retrieves the Page object, currently active.

PolarDraw.ActiveWindow	Retrieves the Window object, currently active.


Appearance (Property)

See Also	Applies To

Returns or sets the paint style of a control at design time. This property is read-only at run time.

Syntax

Appearance [ = style] As polAppearance

The Appearance syntax has these parts:

Part	Description

style	A Constant that determines the current paint style as described in Settings.

Settings

The settings for Appearance are:

polAppearance	Description

ccFlat = 0	Paints the control and forms without visual effects.

cc3D = 1	Paints the control with three-dimensional effects.

Remarks

Default property value is cc3D.


BorderStyle (Property)

See Also	Applies To

Returns or sets the border style for an object.

Syntax

BorderStyle [= value]

The BorderStyle property syntax has these parts:

Part	Description

value	A value or constant that determines the border style, as described in Settings.

Settings

The settings for value are:

Value	Description

ccNone = 0	(Default) No border or border-related elements.

ccFixedSingle = 1	Fixed single.


EnableRendering (Property)

See Also	Applies To	Example

Sets or returns a value that determines whether a screen rendering will be enabled.

Syntax

EnableRendering [ = value] As Boolean

The EnableRendering syntax has these parts:

Part	Description

value	A Boolean expression indicating whether a screen rendering will be enabled.

Settings

The settings for EnableRendering are:

Value	Description

True	Screen rendering is enabled.

False	Screen rendering is disabled.

Remarks

This property is set to 'True' by default, but if you want to apply several effects  to a shape without showing the  results until the it is finalized , set this property to 'False' and apply the Render method. This procedure will decrease the processing time, because the screen will not  be rendered after each action.


RecordUndo (Property)

See Also	Applies To

Enables or disables the recording of Undo commands.

Syntax

RecordUndo [ = value] As Boolean

The RecordUndo syntax has these parts:

Part	Description

value	A Boolean expression indicating whether the undo command is being recorded or not

Settings

The settings for RecordUndo are:

Value	Description

True	Undo recording is enabled.

False	Undo recording is disabled.

Remarks

Use this property if you want to record user actions in order to perform Undo commands. To choose the size of the Undo buffer that will keep the recorded actions, use the UndoSize property.

Default value of this property is True.


UndoSize (Property)

See Also	Applies To

Sets and returns the number of undo commands that can be performed.

Syntax

UndoSize [ = value] As Long

The UndoSize syntax has these parts:

Part	Description

value	The umber of currently permitted undo commands. The command value < 1 means the UndoSize is unlimited.

Remarks

Use this property to save memory, as the UndoSize in fact limits the size of the Undo buffer.

Note:

Setting UndoSize to zero means that the size of the Undo commands is unlimited.


Version (Property)

Applies To

Returns the current version of Polar Draw ActiveX Control.

Syntax

Version [ = value] As Long

The Version syntax has these parts:

Part	Description

value	The current version of Polar Draw ActiveX Control.


LoadEnvironmentFromFile (Property)

See Also	Applies To

Sets or returns a value that determines whether settings of the environment properties will be loaded when the picture loads.

Syntax

LoadEnvironmentFromFile [ = value] As Boolean

The LoadEnvironmentFromFile syntax has these parts:

Part	Description

value	A Boolean expression indicating whether the environment properties are loaded with the picture.

Settings

The settings for LoadEnvironmentFromFile are:

Value	Description

True	Properties that describe the environment are loaded with the picture.

False	Properties that describe the environment are ignored (Picture loads with default environment properties).

Remarks

When the picture is saved on the disk (See Write method) a description of the environment is also saved ie.  whether the paper, scroll-bars and rulers are displayed or not, the paper, background color and position, the color of the grid and guidelines, the measurement units, etc... Each picture has its own environment properties settings and you can decide whether those settings are going to be loaded together with the picture.

In other words, if you want to have pictures and environmenst independent of each other, set this property value to 'False', or to 'True' if you want the picture and the environment to be related.


Enabled (Property)

See Also	Applies To

Returns or sets a value that determines whether a control can respond to user-generated events.

Syntax

Enabled [ = value] As Boolean

The Enabled syntax has these parts:

Part	Description

value	A Boolean expression that specifies whether an object can respond to user-generated events.

Settings

The settings for Enabled are:

Value	Description

True	(Default) Allows object to respond to events.

False	Prevents objects  from responding to events.

Remarks

The Enabled property allows the control to be enabled or disabled at run time. For example, you can disable the control if it does not apply to the current state of the application (Especially if you use the Polar Draw control purely for display purposesand to  provide read-only information).


hWnd (Property)

Applies To

Returns a handle to a control's window.

Syntax

hWnd As OLE_HANDLE

Remarks

A handle is a unique integer value defined by the operating environment and used by the program to identify and switch to an object (such this control).

The Microsoft Windows operating environment identifies each form and control in an application by assigning it a handle, or hWnd. The hWnd property is used with Windows API calls. Many Windows operating environment functions require the hWnd of the active window as an argument.

Note

The Viewport (canvas), rulers and scroll-bars are CHILD windows of the control's window.

Because the value of this property can change while a program is running, never store the hWnd value in a variable.


Modified (Property)

See Also	Applies To

Sets or returns the state of the modified flag which indicates whether modifications have been made to a view.

Syntax

Modified [ = value] As Boolean

The Modified syntax has these parts:

Part	Description

value	A Boolean expression indicating whether modifications have been made to a view.

Settings

The settings for Modified are:

Value	Description

True	Modifications have been made to a view, and after the next change the modified event will not  fire again (See Remarks).

False	The Modified event will fire after the next change (See Remarks).

Remarks

The value of this property indicates whether modifications have been made. When a new view is created, the Modified property is set to 'False'. When something in the view is changed, Modified is set to 'True' and the Modified event is fired. If further changes are made, the Modified event does not fire again. It will not fire again until you set this property to 'False'.

To cause the Modified event to be fired every time a change is made to the workbook, set the modified flag to 'False' within the Modified event.

You can use this flag if you want to remind your end-users to save the document before closing. Just set this property to 'False' whenever a user saves a picture, and check it before closing. If it is 'Tru'e, it means the user modified it and it needs to be saved again.

Note

The Modified event triggers only when process turns this property to 'True', but not if it is set to 'True' programmatically.


ShadowDlg (Method)

See Also	Applies To

Use this method to invoke a dialog box for shadow settings.

Syntax

Sub ShadowDlg()

Remarks

Dialog contains all shadow settings:	shadow color (Color)

shadow type (Type)

shadow offset settings (Offset)

or you can choose not to use shadows (HasShadow)

with sample preview.

Settings made in this dialog box affect all selected shapes.


PatternDlg (Method)

See Also	Applies To

Use this method to invoke a dialog box for pattern selection.

Syntax

Sub PatternDlg()

Remarks

Dialog offers a preview of the Polar Draw assortment of 48 patterns that you can choose, but also contains settings for parameters needed in polPattern Fill Type:

start color (Fill Color)

end color (Fill BackColor)

pattern type (Pattern)

Settings made in this dialog box affect all selected shapes.


GradientDlg (Method)

See Also	Applies To

Use this method to invoke a dialog box for shade settings.

Syntax

Sub GradientDlg()

Remarks

Dialog contains settings for parameters needed in polShade Fill Type:

start color (Color)

end color (BackColor)

shading angle (Angle)

with sample preview.

Settings made in this dialog box affect all selected shapes.


TextureDlg (Method)

See Also	Applies To

Use this method to invoke a dialog box for texture settings.

Syntax

Sub TextureDlg()

Remarks

Dialog offers a preview of 24 predefined textures needed if the Fill Type is set to polTexture. If you do not need the preview, use one of the Texture methods. Settings made in this dialog box affect all selected shapes.


LensDlg (Method)

See Also	Applies To

Use this method to invoke a dialog box for lens effect selection.

Syntax

Sub LensDlg()

Remarks

Dialog offers settings for parameters needed in lens effect selection:

lens type (Type)

start color (Color)

end color (BackColor)

effect percent (Percent)

with sample preview.

Settings made in this dialog box affect all selected shapes.


ArrowsDlg (Method)

See Also	Applies To

Use this method to invoke a dialog box for arrow settings.

Syntax

Sub ArrowsDlg()

Remarks

Dialog contains all arrow settings:	arrowhead style (Head)

arrowhead length (Length)

arrowhead width (Width)

with the sample preview.

Settings made in this dialog box affect all selected shapes.


LineDlg (Method)

See Also	Applies To

Use this method to invoke a dialog box for line settings.

Syntax

Sub LineDlg()

Remarks

Dialog contains all line settings except the arrow settings that are defined in a separate dialog (ArrowsDlg):

line color (Color)

line width (Width)

line dashing style (Dashing)

show outline (HasLine)

with the sample preview.

Settings made in this dialog box affect all selected shapes.


Copy (Method)

See Also	Applies To

Copies the current selection in the Clipboard.

Syntax

Function Copy() As Boolean

Return value

Value	Description

True	The selection is successfully copied.

False	An error occurred during the execution.


Cut (Method)

See Also	Applies To

Removes the selection from the control’s view and places it on the Clipboard.

Syntax

Function Cut() As Boolean

Return value

Value	Description

True	The selection is successfully cut.

False	An error occurred during the execution.


Paste (Method)

See Also	Applies To

Inserts the contents of the Clipboard at the insertion point.

Syntax

Function Paste() As Boolean

Return value

Value	Description

True	The Clipboard content is successfully pasted.

False	An error occurred during the execution.


Read (Method)

See Also	Applies To	Example

Loads the drawing from the PDR file to the Polar Draw control.

Syntax

Function Read(szFileName As String) As Boolean

The Read method syntax has the following parts:

Part	Description

szFileName	A string expression defining the path and filename.

Return value

Part	Description

True	The picture is loaded successfully.

False	An error occurred during the picture loading.

Remarks

If this function fails, the ErrorReadingFile event occurs.


Render (Method)

See Also	Applies To	Example

Renders the screen.

Syntax

Sub Render()

Remarks

Use this method to render the picture, after applying several methods keeping the EnableRendering  property value to 'False'. This procedure will save the processing time because the screen will not be rendered after each action.


Redo (Method)

See Also	Applies To

If possible, use this method for re-doing the last action.

Syntax

Sub Redo()

Remarks

This method is related to the Undo method. Polar Draw can perform an unlimited number of Undo/Redo operations. For setting the option for recording undo operations, set the RecordUndo property to 'True'. If you want to limit the number of possible undo/redo operations use the UndoSize property.


Undo (Method)

See Also	Applies To

If possible, use this method for undoing the last action.

Syntax

Sub Undo()

Remarks

This method is related with the Redo method. Polar Draw can perform an unlimited number of Undo/Redo operations. For setting the option for recording undo operations, set the RecordUndo property to 'True'. If you want to limit the number of possible undo/redo operations use the UndoSize property.


Write (Method)

See Also	Applies To	Example

Saves the picture to a file specified by name (szFileName)and type (lType).

Syntax

Function Write(szFileName As String, lType As Long) As Boolean

The Write method syntax has these parts:

Part	Description

szFileName	A string expression defining the path and filename of the file to receive the contents of the control.

lType	A number that determines the file format as described in Settings. The current version (1.0) supports only the PDR file format.

Settings

lType	Description

1	Polar Draw file format (.PDR)

2	Metafile (.EMF)

Return value

Part	Description

True	The picture is saved successfully.

False	An error occurred during picture saving.

Remarks

Polar Draw can save pictures in its own format (PDR) and as metafiles.

If this function fails, ErrorWritingFile event occurs.


EditTextDlg (Method)

See Also	Applies To

Displays the dialog box for text editing.

Syntax

Sub EditTextDlg()

Remarks

Use this method when you want to change selected text. If more than one text-box is  selected, EditTextBox will display the text that was last selected.


FontDlg (Method)

See Also	Applies To

Displays dialog box for changing font.

Syntax

Sub FontDlg()

Remarks

Use this method when you want to change the font of the selected text. If more than one text-box is selected, the changes performed in FontDlg dialog-box will affect the text that was last selected.


PageSetupDlg (Method)

See Also	Applies To

Displays the dialog box for setting the page .

Syntax

Sub PageSetupDlg()

Remarks

Use this method to invoke the dialog box for setting the page. The end-user can choose the size, source and orientation of the paper. Changing options in this dialog box directly influences the  PageWidth and the PageHeight properties, as well as the Landscape property.


PrintDocument (Method)

See Also	Applies To

Prints the drawing.

Syntax

Function PrintDocument(fShowDialog As Boolean) As Boolean

The PrintDocument method syntax has these parts:

Part	Description

fShowDialog	A Boolean expression that indicates whether the PrintSetup dialog will be displayed or not.

Return value

Part	Description

True	The picture is successfully printed.

False	An error occurred during picture printing.

Remarks

Use this method if you want to print the whole drawing, or just a part of it. You can choose to  display a dialog box for setting the printer as well. End-user can specify the printer, number of copies, or print range ie. Either the  whole drawing, or just the current selection.


AllowErrorReporting (Property)

See Also	Applies To

Sets or returns a value that determines whether errors will be reported or ignored.

Syntax

AllowErrorReporting [ = value] As Boolean

The AllowErrorReporting syntax has these parts:

Part	Description

value	A Boolean expression indicating whether errors will be reported or not.

Settings

The settings for AllowErrorReporting are:

Value	Description

True	Errors will be reported.

False	Errors will be ignored.

Remarks

All errors can be discarded if you set the AllowErrorReporting property to False. The best practice is to keep this property value 'True' during developing time because error reporting will make bug tracing easier.

In the release build of your application switch it to 'False', so your users will not have unexpected terminations of your program.

The default value of this property is 'True'.


MeasurementUnits (Property)

See Also	Applies To

Sets and returns current measurement units.

Syntax

MeasurementUnits [ = units] As polMeasurementUnits

The MeasurementUnits syntax has these parts:

Part	Description

units	A constant that determines the current measurement units as described in Settings.

Settings

The settings for MeasurementUnits are:

polMeasurementUnits	Description

polUnitsHimetric = 0	Measurement Unit: 0.01 mm

polUnitsMilimeter = 1	Measurement Unit: 1 mm

polUnitsCentimeter = 2	Measurement Unit: 10 mm

polUnitsTwips = 3	Measurement Unit: 1 twips = 1/1440 inch

polUnitsHienglish = 4	Measurement Unit: 0.001 inch

polUnitsInch = 5	Measurement Unit: 1 inch

polUnitsPoint = 6	Measurement Unit: 1 point = 1/72 inch

polUnitsPica = 7	Measurement Unit: 1 pica = 12 points = 1/6 inch

polUnitsPixel = 8	Measurement Unit: 1 pixel

Remarks

This property value affects all methods that use parameters in some measurement unit. Polar Draw has its own measurement units (twips), but this property will enable you to convert Polar Draw into one of the 9 measurement units offered.

Note

Measurement units are expressed as integer values. This means if you want to set PageHeight to 29.7cm, you must set MeasurementUnits to millimeters first, because Polar Draw will discard all digits after the decimal point. If you want to get real dimensions, use Twips as MeasurementUnits.

Example:

1)

'incorrect: PageHeight will be set to 29cm

PolarDraw1.MeasurementUnits = polUnitsCentimeter

PolarDraw1.ActivePage.Height = 29,7

2)

'correct: PageHeight will be set to 297mm = 29,7cm

PolarDraw1.MeasurementUnits = polUnitsMilimeter

PolarDraw1.ActivePage.Height = 297


ActivePage (Property)

See Also	Applies To

Returns a Page object that represents the currently active page. This property is read-only.

Syntax

ActivePage As Page


ActiveWindow (Property)

See Also	Applies To

Returns a Window object that represents the currently active window. This property is read-only.

Syntax

ActiveWindow As Window


HyperlinkBase (Property)

See Also	Applies To	Example

Sets and returns the base of all hyperlinks in the document.

Syntax

HyperlinkBase [ = string] As String

HyperlinkBase property syntax has these parts:

Part	Description

string	A string expression representing the hyperlink base.

Remarks

This property allows you to define the same root for each hyperlink on the active document. This is useful when you are analyzing a web site.

For example. If all hyperlink shapes are going to point to the same web site, you can set HyperlinkBase to the site URL and each shape will have to carry only the relative address in the Address property.

Example:

PolarDraw1.HyperlinkBase = “www.polarsoftware.com/”

PolarDraw1.ActivaPage.Shapes(1).AddHyperlink

PolarDraw1.ActivaPage.Shapes(1).Hyperlink.Address = “draw.html”

Polar Draw will join HyperlinkBase and the Address values to just one string:

”www.polarsoftware.com/draw.html”


PageHeight (Property)

See Also	Applies To

Sets or returns the page height.

Syntax

PageHeight [ = height] As Long

The PageHeight syntax has these parts:

Part	Description

height	A numeric expression representing the paper height expressed in MeasurementUnits.

Remarks

This property can also be changed by the end-user in the PageSetup dialog.

The default page height is 297 millimeters (A4 paper dimension).


PageWidth (Property)

See Also	Applies To

Sets or returns the page width.

Syntax

PageWidth [ = width] As Long

The PageWidth syntax has these parts:

Part	Description

width	A numeric expression representing the page width expressed in MeasurementUnits.

Remarks

This property can also be changed by the end-user in the PageSetup dialog. box

The default page width is 210 millimeters (A4 paper dimension).


ShowConnectors  (Property)

See Also	Applies To

Sets or returns a value that determines whether connection ports will be shown or not.

Syntax

ShowConnectors [ = value] As Boolean

The ShowConnectors  syntax has these parts:

Part	Description

value	A Boolean expression indicating whether connection ports will be shown or not.

Settings

The settings for ShowConnectors  are:

Value	Description

True	Ports are visible all the time.

False	Ports are not visible.

Remarks

You can turn this property to 'True' whenever your users need to see where the connection ports.are You can keep them visible all the time, or just when you are allowing your users to add or edit connections (when CurrentShapeType property is set to polLink, or when in polEditPoints EditMode mode).

Example

This example shows how to switch this property on only when the user can draw links. cmbShape is a ComboBox which contains all shape types.

Private Sub cmbShape_Click()

pd_environment.CurrentShapeType = cmbShape.ItemData(cmbShape.ListIndex)

If pd_environment.CurrentShapeType = polLink Then

POLARDraw1.ShowConnectors = True

Else

POLARDraw1.ShowConnectors = False

End If

End Sub


WriteToHDC (method)

Applies To

Writes a picture to a HDC ( handle to the Device Context)

Syntax

WriteToHDC (hdc As Long)

The WriteToHDC syntax has these parts:

Part	Description

hdc	A value set to the target object's hDC property (OLE_HANDLE)

Remarks

Method preserves zoom and origins as in the original window.


WriteToBlob (method)

See Also 	Apllies to

Writes a picture to a BLOB variable.

Syntax

The WriteToBlob method syntax has these parts:

WriteToBlob (phBlob As Long)

Part	Description

phBlob	OLE_HANDLE,reference to a BLOB variable in memory.

Remarks

Once a picture is written to a BLOB, it can be stored in a database or passed to ReadFromBlob.


ReadFromBlob (method)

See Also	Applies To

Reads a picture that has been stored in memory in a BLOB variable.

Syntax

The ReadFromBlob method syntax has these parts:

ReadFromBlob (hBlob As Long)

Part	Description

phBlob	OLE_HANDLE,reference to a BLOB variable in memory.

Remarks

If a picture was previously saved as a BLOB in a database, it must be assigned to a BLOB type variable before it is passed to ReadFromBlob.


Window (Object)

See Also	Properties	Methods

A Window object represents an open window in a Polar Draw instance.

Remarks

To retrieve the active window in an instance of Polar Draw, use the ActiveWindow property of the Control object.

To retrieve a Page object that represents the page shown in the window, use the Page property of a Window object.


ViewportOriginX (Property)

See Also	Applies To

Sets and returns the X-coordinate of the control’s viewport with respect to the canvas origin (0,0). (The canvas origin (0,0) is the top-left corner of the canvas.)

Syntax

ViewportOriginX [ = position] As Long

The ViewportOriginX syntax consists of the following parts:

Part	Description

position	A numeric expression representing the X-coordinate of the control’s view expressed in MeasurementUnits.

Remarks

Use this property when you want to change the viewport origin.


ViewportOriginY (Property)

See Also	Applies To

Sets and returns the Y-coordinate of the control’s viewport with respect to the canvas origin (0,0). (The origin of canvas is the canvas top-left corner.)

Syntax

ViewportOriginY [ = position] As Long

The ViewportOriginY syntax consists of the following parts:

Part	Description

position	A numeric expression representing the Y-coordinate of the control’s view expressed in MeasurementUnits.

Remarks

Use this property when you want to change the viewport origin.


PageToWindow (Method)

See Also	Applies To	Example

Converts page coordinates, expressed in MeasurementUnits to the viewport coordinates, expressed in pixels.

Syntax

Sub PageToWindow(pX As Long, pY As Long)

The PageToWindow method syntax consists of the following parts:

Part	Description

pX	A number that specifies the x-coordinate of the point.

pY	A number that specifies the y-coordinate of the point.

Remarks

Coordinates are returned through the pX and pY parameters. Each of them has to be declared separately. For example:

(pX, pY)-> (pX, pY)


WindowToPage (Method)

See Also	Applies To	Example

Converts the window coordinates, expressed in pixels, to the page coordinates, expressed in MeasurementUnits.

Syntax

Sub WindowToPage(pX As Long, pY As Long)

The WindowToPage method syntax consists of the following parts:

Part	Description

pX	A number that specifies the x-coordinate of the point.

pY	A number that specifies the y-coordinate of the point.

Remarks

The coordinates are returned through the pX and pY parameters and they are expressed in MeasurementUnits. Each of them has to be declared separately. For example:

(pX, pY)-> (pX, pY)


UnitsToPixels (Method)

See Also	Applies To	Example

Converts the point coordinates, expressed in MeasurementUnits, to pixels.

Syntax

Sub UnitsToPixels(pX As Long, pY As Long)

The UnitsToPixels method syntax consists of the following parts:

Part	Description

pX	A number that specifies the x-coordinate of the point.

pY	A number that specifies the y-coordinate of the point.

Remarks

The coordinates are returned through the pX and pY parameters, and they are expressed in pixels. Each of them has to be declared separately. See Example.

Note

Be careful, because this method does not include setting the Zoom  property. It just converts the units and not the distances! To convert the distance on the page that is expressed in units, to the distance in pixels with respect to the current magnification and the window origin, use the PageToWindow method.


PixelsToUnits (Method)

See Also	Applies To	Example

Converts the point coordinates from pixels to MeasurementUnits.

Syntax

Sub PixelsToUnits(pX As Long, pY As Long)

The PixelsToUnits method syntax consists of the following parts:

Part	Description

pX	A number that specifies the x-coordinate of the point.

pY	A number that specifies the y-coordinate of the point.

Remarks

Coordinates are returned through the pX and pY parameters and they are expressed in the current MeasurementUnits. Each of them has to be declared separately. See Example.

Note

Be careful, because this method does not include setting the Zoom property. It just converts the units and not the distances! To convert the distance in the window that is expressed in pixels, to the distance in units with respect to the current magnification and the page origin, use the WindowToPage method.


FitTo (Method)

See Also	Applies To

Use this method to set the magnification, depending on the parameter.

Syntax

Sub FitTo(lType As polFitType)

The FitTo method syntax consists of the following parts:

Part	Description

polFitType	Constant described in settings.

Settings

polFitType	Description

polFitToPage = 0	Adjusts the magnification so the paper height and width fit to the control's viewport dimensions.

polFitToSelection = 1	Adjusts the magnification so the current selection fit to the control's viewport dimensions.

polFitToWidth = 2	Adjusts the magnification so the paper width fits to the control's viewport dimensions.

polFitToHeight = 3	Adjusts the magnification so the paper height fits to the control's viewport dimensions.

Remarks

This method affects the Zoom property.


CenterPage (Method)

See Also	Applies To

Use this method for setting the page at the center of the control’s viewport.

Syntax

Sub CenterPage()

Remarks

This method does not change the value of the Zoom property. It does not change the magnification, it simply centers the page.


Environment (Property)

See Also	Applies To

Returns the Environment object that contains all the attributes of one window. This property is read-only.

Syntax

Environment As Environment


Page (Property)

See Also	Applies To

Returns a Page object that represents the page that is shown in the window. This property is read-only.

Syntax

Page As Page


# HID_hWnd_window$ hWnd (Property)K hWnd (Property)@ Status|1|0|0|0||||||hWnd (Property)

See Also	Applies To

Returns a handle to a window.

Syntax

hWnd [ = hWnd ] As OLE_HANDLE

Remarks

A handle is a unique integer value defined by the operating environment and used by the program to identify and switch to an object (such this control).

The Microsoft Windows operating environment identifies each form and control in an application by assigning it a handle, or hWnd. The hWnd property is used with Windows API calls. Many Windows operating environment functions require the hWnd of the active window as an argument.

Note

Viewport (canvas), rulers and scroll-bars are CHILD windows of the control's window. hWnd of the Window object is a hWnd of the Viewport (canvas).

Because the value of this property can change while a program is running, never store the hWnd value in a variable.


Environment (Object)

See Also	Properties

The environment object represents all attributes which describe the window environment.

Remarks

You can retrieve the Environment object using the Environmentfrom the Windowobject. You can use it to define whether the rulers, scroll-bars, grid and guidelines will be shown, whether the shapes will align to the grid or guidelines and which actions the end-users will be able to perform using the mouse (see the set of Allow… properties).

All the properties that are applied to the Environment object can also be applied to the Control object. This is just because we wanted to make it easier for the user by making the properties of the Control object available from the Properties window.

Example

This is a sample of how to create a function that will set some of the Environment properties. pd_Environment is a Polardraw20Lib.Environment object.

Public Sub SetEnvironment()

With pd_Environment

.EditMode = polResize

.RulerMeasurementUnits = polUnitsMilimeter

.ShowHorizontalRuler = True

.ShowHorizontalScrollBar = True

.ShowVerticalRuler = True

.ShowVerticalScrollBar = True

.ShowGrid = False

End With

pd_Window.CenterPage

End Sub


ShowGrid (Property)

See Also	Applies To	Example

Sets or returns a value that determines whether the grid is going to be shown.

Syntax

ShowGrid [ = value] As Boolean

The ShowGrid syntax has these parts:

Part	Description

value	A Boolean expression indicating whether the grid is shown or not.

Settings

The settings for ShowGrid are:

Value	Description

True	Grid is displayed.

False	Grid is not displayed.

Remarks

The default value of this property is 'False'.


ShowGuidelines (Property)

See Also	Applies To	Example

Sets or returns a value that determines whether the guidelines are going to be shown.

Syntax

ShowGuidelines [ = value] As Boolean

The ShowGuidelines syntax has these parts:

Part	Description

value	A Boolean expression indicating whether the guidelines are shown or not.

Settings

The settings for ShowGuidelines are:

Value	Description

True	Guidelines are displayed.

False	Guidelines are not displayed.

Remarks

The default value of this property is 'False'.


SnapToGrid (Property)

See Also	Applies To	Example

Sets or returns a value that determines whether the drawn shapes are going to align to the grid.

Syntax

SnapToGrid [ = value] As Boolean

The SnapToGrid syntax has these parts:

Part	Description

value	A Boolean expression indicating whether the shapes are snapped to grid or not.

Settings

The settings for SnapToGrid are:

Value	Description

True	The shape will align to the grid.

False	The shape will not align to the grid.

Remarks

The default value of this property is 'False'.


SnapToGuidelines (Property)

See Also	Applies To	Example

Sets or returns a value that determines whether the drawn shapes are going to align to the guidelines.

Syntax

SnapToGuidelines [ = value] As Boolean

The SnapToGuidelines syntax has these parts:

Part	Description

value	A Boolean expression indicating whether the shapes are snapped to the guidelines or not.

Settings

The settings for SnapToGuidelines are:

Value	Description

True	The shape will align to the guidelines.

False	The shape will not align to the guidelines.

Remarks

Default value of this property is False.


Zoom (Property)

See Also	Applies To	Example

Sets and returns the scale for your drawing. In Polar Draw, the scale represents a ratio between the drawing (page distance) and the real world (world distance).

Syntax

Zoom[ = number] As Long

The Zoom property syntax consists of the following parts:

Part	Description

number	Specifies how the displayed drawing is to be scaled up or down (described in Settings). Can range from 10 to 1000, (expressed in percentage).

Settings

The settings for Zoom are:

Number	Description

< 100	Reduces picture size.

> 100	Enlarges picture size.

= 100	Picture is displayed in its original size.

Remarks

The default property value is 100%.

If you want to adjust the drawing to the drawing window, choose one of the methods from the View category.


AllowDelete (Property)

See Also	Applies To	Example

Sets or returns a value that determines whether deletion of the shapes will be allowed.

Syntax

AllowDelete [ = value] As Boolean

The AllowDelete syntax consists of the following parts:

Part	Description

value	A Boolean expression indicating whether deletion of the shapes is allowed or not.

Settings

The settings for AllowDelete are:

Value	Description

True	Shapes can be deleted.

False	Shapes cannot be deleted.

Remarks

When the user presses the Delete button on the keyboard, selected shapes will be deleted if the Polar Draw control is in focus and if this property is set to 'True'. The default value of this property is 'True'.


AllowEditPoints (Property)

See Also	Applies To	Example

Sets or returns a value that determines whether editing points will be allowed.

Syntax

AllowEditPoints [ = value] As Boolean

The AllowEditPoints syntax consists of the following parts:

Part	Description

value	A Boolean expression indicating whether the editing points are allowed or not.

POLARDraw1.AllowEditPoints = True

POLARDraw1.EditMode = polEditPoints

Settings

The settings for AllowEditPoints are:

Value	Description

True	Line points can be edited.

False	Line points cannot be edited.

Remarks

The curve points could be edited if the current EditMode is set to polEditPoints, and if this property is set to 'True'. The default value of this property is 'True'.


AllowMove (Property)

See Also	Applies To	Example

Sets or returns a value that determines whether moving  the shape will be allowed.

Syntax

AllowMove [ = value] As Boolean

The AllowMove syntax consists of the following parts:

Part	Description

value	A Boolean expression indicating whether moving the shape is allowed or not.

Settings

The settings for AllowMove are:

Value	Description

True	Shapes can be moved.

False	Shapes cannot be moved.

Remarks

When the current EditMode is set to polResize, polEditPoints or polRotate, the shapes can be selected or moved. Set this property to 'False' if you want to disable the moving of the shape.

The default value of this property is 'True'.


AllowResize (Property)

See Also	Applies To	Example

Sets or returns a value that determines whether resizing  the shape will be allowed.

POLARDraw1.AllowResize = True

POLARDraw1.EditMode = polResize

Syntax

AllowResize [ = value] As Boolean

The AllowResize syntax has these parts:

Part	Description

value	A Boolean expression indicating whether resizing the shape is allowed or not.

Settings

The settings for AllowResize are:

Value	Description

True	Shapes can be resized.

False	Shapes cannot be resized.

Remarks

When the current EditMode is set to polResize, the shapes can be resized, selected or moved. Set this property to 'False' if you want to forbid shape resizing.

Default value of this property is 'True'.


AllowRotate (Property)

See Also	Applies To	Example

Sets or returns a value that determines whether rotation of shapes will be allowed.

POLARDraw1.AllowRotate = True

POLARDraw1.EditMode = polRotate

Syntax

AllowRotate [ = value] As Boolean

The AllowRotate syntax consists of the following parts:

Part	Description

value	A Boolean expression indicating whether rotation of the shape is allowed or not.

Settings

The settings for AllowRotate are:

Value	Description

True	Shapes can be rotated.

False	Shapes cannot be rotated.

Remarks

When the current EditMode  mode is set to polRotate, the shapes can be selected or rotated. Set this property to 'False' if you want to disable the rotation of the shape.

The default value of this property is 'True'.


AllowSelect (Property)

See Also	Applies To	Example

Sets or returns a value that determines whether shape selection is allowed.

Syntax

AllowSelect [ = value] As Boolean

The AllowSelect syntax consists of the following parts:

Part	Description

value	A Boolean expression indicating whether shape selection is allowed or not.

Settings

The settings for AllowSelect are:

Value	Description

True	Shapes can be selected.

False	Shapes cannot be selected.

Remarks

When the current EditMode is set to polResize, polEditPoints or polRotate, the shapes can be selected or moved. Set this property to 'False' if you want to disable shape selecting.

The default value of this property is 'True'.


AllowWheel (Property)

See Also	Applies To	Example

Sets or returns a value that determines whether the document can be scrolled through using the mouse wheel.

Syntax

 AllowWheel [ = value] As Boolean

The AllowWheel syntax consists of the following parts:

Part	Description

value	A Boolean expression indicating whether the current document can be scrolled using the mouse wheel.

Settings

The settings for AllowWheel are:

Part	Description

True	Mouse wheel scrolling is allowed.

False	Mouse wheel scrolling is not allowed.

Remarks

For Windows 95 or Windows NT 3.51:

To use this feature, an application must register the WM_MOUSEWHEEL message first. Applications created in MS Visual C+ by MFC App Wizard do this by default while  applications created with Visual Basic do not.


AllowDragSelect (Property)

See Also	Applies To	Example

Sets or returns a value that determines whether shape selection by way of dragging a mouse around the shapes is allowed.

Syntax

AllowDragSelect [ = value] As Boolean

The AllowDragSelect syntax consists of the following parts:

Part	Description

value	A Boolean expression indicating whether shape selection  by way of dragging the mouse is allowed or not.

POLARDraw1.AllowDragSelect = True

POLARDraw1.EditMode = polResize

Settings

The settings for AllowDragSelect are:

Value	Description

True	Shape selection by dragging is allowed.

False	Shape selection by dragging is not allowed.


CurrentPolygonType (Property)

See Also	Applies To	Example

Sets and returns the current polygon type. This means that each left mouse click on the drawing canvas will invoke the creation of one of these polygon types if the EditMode  mode is set to polCreateNew and the CurrentShapeType type is set to polFreeform.

Syntax

CurrentPolygonType [ = polygon type] As polPolygonTypes

The CurrentPolygonType syntax consists of the following parts:

Part	Description

polygon type	A constant that determines the current polygon type as described in Settings.

Settings

The settings for CurrentPolygonType are:

polPolygonTypes	Description

polCurvePoly = 1	Curve

polFreeformPoly = 2	Freeform

polScribblePoly = 3	Scribble

Remarks

The default polygon type is polFreeformPoly. These polygons can only be added manually by the user of an application that utilizes a Polar Draw ActiveX Control, while all other shapes (see CurrentShapeType) can be added by the AddShape method.


CurrentShapeType (Property)

See Also	Applies To	Example

Sets and returns the current shape type. This means that each left mouse click on the drawing canvas will invoke the creation of one of these shapes if the EditMode  mode is set to polCreateNew.

Syntax

CurrentShapeType [ = shape type] As polShapeType

The CurrentShapeType syntax consists of the following parts:

Part	Description

shape type	A constant that determines the current shape type as described in Settings.

Settings

The settings for CurrentShapeType are:

polShapeType	Description

polFreeform = 0	One of the Freeform polygons (look at CurrentPolygonType )

polRectangle = 1	Rectangle

polRoundRectangle = 2	Rectangle with rounded corners

polEllipse = 3	Ellipse

polDiamond = 4	Diamond

polIsoscelesTriangle = 5	Triangle

polRightTriangle = 6	Right triangle

polParallelogram = 7	Parallelogram

polTrapezoid = 8	Trapezoid

polHexagon = 9	Hexagon

polOctagon = 10	Octagon

polPlusSign = 11	Plus Sign (Cross)

polStar = 12	Star

polArc = 19	Arc

polLine = 20	Line

polPentagon = 56	Pentagon

polLeftArrow = 66	Left arrow

polPlainText = 136	Text

polTextBox = 202	Text box

polLink = 10000	Link (freeform shape that defines Connection between two other shapes)

polDimensionBar = 10250	Dimension bar

Remarks

All these shapes can be added manually or programmatically by  using the AddShape method.

The default shape type is polRectangle. Shapes of different types are shown in the above picture .


EditMode (Property)

See Also	Applies To	Example

Sets and returns the current edit mode. This property determines whether the mouse left-cick on the drawing canvas  invokes the creation of a new shape or enables one of the modes used for editing the existing shapes (moving, resizing, rotating, editing points).

Syntax

EditMode [ = shape mode] As polShapeMode

The EditMode syntax consists of the follwing parts:

Part	Description

shape mode	Constant that determines the current editing mode as described in Settings.

POLARDraw1.EditMode = polRotate

Settings

The settings for EditMode are:

polShapeMode	Description

polResize = 1	Activates the resize mode.

polRotate = 2	Activates the rotation mode.

polEditPoints = 3	Activates the mode for editing points.

polCreateNew = 4	Enables the creation of the new shape, where its type is defined by the CurrentShapeType property.

polView = 6	Mode in which any end-user interaction is disabled. It is useful just for previewing the picture.

Remarks

The default shape type is polCreateNew. When this property is set to polCreateNew, it is necessary to determine the value of the CurrentShapeType property. This property determines the type of the shape that is going to be created.

Check for the Allow properties before applying one of the first three EditModes.


RulerMeasurementUnits (Property)

See Also	Applies To	Example

Sets and returns the unit of measurement that will be displayed on the rulers.

Syntax

RulerMeasurementUnits [ = unit] As polMeasurementUnits

The RulerMeasurementUnits syntax consists of the following parts:

Part	Description

unit	Constant that determines the current measurement units as described in Settings.

Settings

The settings for RulerMeasurementUnits are:

polMeasurementUnits	Description

polUnitsHimetric = 0	Measurement Unit: 0.01 mm

polUnitsMilimeter = 1	Measurement Unit: 1 mm

polUnitsCentimeter = 2	Measurement Unit: 10 mm

polUnitsTwips = 3	Measurement Unit: 1 twips = 1/1440 inch

polUnitsHienglish = 4	Measurement Unit: 0.001 inch

polUnitsInch = 5	Measurement Unit: 1 inch

polUnitsPoint = 6	Measurement Unit: 1 point = 1/72 inch

polUnitsPica = 7	Measurement Unit: 1 pica = 12 points = 1/6 inch

polUnitsPixel = 8	Measurement Unit: 1 pixel

Remarks

This property affects only the rulers display and does not affect the performance of  the methods that need dimensions as parameters (like MeasurementUnits).

The default property value is polUnitsMilimeter.


ShowHorizontalRuler (Property)

See Also	Applies To	Example

Sets or returns a value that determines whether the horizontal ruler is going to be shown.

Syntax

ShowHorizontalRuler [ = value] As Boolean

The ShowHorizontalRuler syntax consists of the following parts:

Part	Description

value	A Boolean expression indicating whether the horizontal ruler is shown or not.

Settings

The settings for ShowHorizontalRuler are:

Value	Description

True	Horizontal ruler is displayed.

False	Horizontal ruler is not displayed.

Remarks

The default value of this property is 'True'.


ShowHorizontalScrollBar (Property)

See Also	Applies To	Example

Sets or returns a value that determines whether the horizontal scroll-bar is going to be shown.

Syntax

ShowHorizontalScrollBar [ = value] As Boolean

The ShowHorizontalScrollBar syntax consists of the following parts:

Part	Description

value	A Boolean expression indicating whether the horizontal scroll-bar is shown or not.

Settings

The settings for ShowHorizontalScrollBar are:

Value	Description

True	Horizontal scroll-bar is displayed.

False	Horizontal scroll-bar is not displayed.

Remarks

The default value of this property is 'True'.


ShowVerticalRuler (Property)

See Also	Applies To	Example

Sets or returns a value that determines whether the vertical ruler is going to be shown.

Syntax

ShowVerticalRuler [ = value] As Boolean

The ShowVerticalRuler syntax has these parts:

Part	Description

value	A Boolean expression indicating whether vertical ruler is shown or not.

Settings

The settings for ShowVerticalRuler are:

Value	Description

True	Vertical ruler is displayed.

False	Vertical ruler is not displayed.

Remarks

The default value of this property is 'True'.


ShowVerticalScrollBar (Property)

See Also	Applies To	Example

Sets or returns a value that determines whether the vertical scroll-bar is going to be shown.

Syntax

ShowVerticalScrollBar [ = value] As Boolean

The ShowVerticalScrollBar syntax consists of the following parts:

Part	Description

value	A Boolean expression indicating whether the vertical scroll-bar is shown or not.

Settings

The settings for ShowVerticalScrollBar are:

Value	Description

True	Vertical scroll-bar is displayed.

False	Vertical scroll-bar is not displayed.

Remarks

The default value of this property is 'True'.


ShowSelection (Property)

See Also	Applies To	Example

Sets or returns a value that determines whether the selection handles will be shown or not.

Syntax

ShowSelection [ = value] As Boolean

The ShowSelection syntax consists of the following parts:

Part	Description

value	A Boolean expression indicating whether the selection handles for selected shapes will be displayed.

Settings

The settings for ShowSelection are:

Value	Description

True	Selection handles are visible.

False	Selection handles are not visible.

Remarks

The Bounding rectangle of each shape is marked with selection handles. Those handles are displayed:

•	as little white rectangles if EditMode is set to polCreateNew or polResize

•	as little green circles if EditMode is set to polRotate

•	as little black rectangles if EditMode is set to polEditPoints

polResize	polEditPoints	polRotate

If you do not want to display the selection handles, set this property to 'False'.


AllowDeletePoints (Property)

See Also	Applies To

Sets or returns a value that determines whether the polygon points can be deleted.

Syntax

AllowDeletePoints [ = value] As Boolean

The AllowDeletePoints syntax consists of the following parts:

Part	Description

value	A Boolean expression indicating whether the polygon points can be deleted or not.

Settings

The settings for AllowDeletePoints are:

Value	Description

True	Points can be deleted.

False	Points cannot be deleted.

Remarks

When in polEditPoints edit mode, the user can not only move existing points  and create new ones, but he/she can also delete existing points (by clicking on point and having  the Shift key down). By setting this property to 'False', the user will be disabled from using this ability.


Page (Object)

See Also	Properties	Methods

The Page object represents all the properties of the page.

Remarks

Currently, each Polar Draw instance contains only one page but we are planning to add the  possibility of multiple pages to Polar Draw. In that case, a Page object will represent one element in the Pages collection (this has not been implemented yet).

Some of the properties that are applied to the Page object can also be applied to the Control object. This is just because we wanted to make using them easier as the  properties of the Control object are available from the Properties window.

Those properties are:

BackgroundColor

GridColor

GuidelineColor

Landscape

HorizontalGrid

PageHeight

PageWidth

PaperColor

ShowPaper

VerticalGrid


BackgroundColor (Property)

See Also	Applies To

Sets and returns the color of the paper background. (Canvas color)

Syntax

BackgroundColor [ = color] As OLE_COLOR

The BackgroundColor syntax consists of the following:

Part	Description

color	This value can be one of the normal RGB Colors. It represents the canvas color.

Remarks

The default value of this property is &H00C0C0C0& (Gray).


CanvasHeight (Property)

See Also	Applies To

Returns the height of the drawing canvas.

Syntax

CanvasHeight [ = height] As Long

The CanvasHeight syntax consist of the following parts:

Part	Description

height	A numeric expression representing the canvas height expressed in MeasurementUnits.

Remarks

This property is read-only.


CanvasWidth (Property)

See Also	Applies To

Returns the width of the drawing canvas.

Syntax

CanvasWidth [ = width] As Long

The CanvasWidth syntax consists of the following parts:

Part	Description

width	A numeric expression representing the canvas width expressed in MeasurementUnits.

Remarks

This property is read-only.


ShowPaper (Property)

See Also	Applies To

Sets or returns a value that determines whether the page is going to be shown.

Syntax

ShowPaper [ = value] As Boolean

The ShowPaper syntax consists of the following:

Part	Description

value	A Boolean expression indicating whether the paper is shown or not.

Settings

The settings for ShowPaper are:

Value	Description

True	Paper is displayed.

False	Paper is not displayed.

Remarks

The default value of this property is 'True'. The picture above shows shapes drawn on the canvas, without the paper.


ShowPaperOutline (Property)

See Also	Applies To

Sets or returns a value that determines whether the paper outline is going to be shown.

Syntax

ShowPaperOutline [ = value] As Boolean

The ShowPaperOutline syntax consists of the following parts:

Part	Description

value	A Boolean expression indicating whether the paper outline is shown or not.

Settings

The settings for ShowPaperOutline are:

Value	Description

True	Paper outline is displayed.

False	Paper outline is not displayed.

Remarks

The default value of this property is 'True'.


ShowPaperShadow (Property)

See Also	Applies To

Sets or returns a value that determines whether the paper shadow is going to be shown.

Syntax

ShowPaperShadow [ = value] As Boolean

The ShowPaperShadow syntax consists of the following parts:

Part	Description

value	A Boolean expression indicating whether the paper shadow is shown or not.

Settings

The settings for ShowPaperShadow are:

Value	Description

True	Paper shadow is displayed.

False	Paper shadow is not displayed.

Remarks

The default value of this property is 'True'.


GridColor (Property)

See Also	Applies To

Sets and returns the grid color.

Syntax

GridColor [ = color] As OLE_COLOR

The GridColor syntax consists of the following parts:

Part	Description

color	This value can be one of the normal RGB Colors. It represents the color of the grid.

Remarks

The default value of this property is &H00FF0000& (Blue).


GuidelineColor (Property)

See Also	Applies To

Sets and returns the color of the guidelines.

Syntax

GuidelineColor [ = color] As OLE_COLOR

The GuidelineColor syntax has the following parts:

Part	Description

color	This value can be one of the normal RGB Colors. It represents the color of the guidelines.

Remarks

The default value of this property is &H00FF0000& (Blue).


HorizontalGrid (Property)

See Also	Applies To

Sets or returns the horizontal spacing between the gridlines.

Syntax

 HorizontalGrid [ = width] As Long

The HorizontalGrid syntax consists of the following parts:

Part	Description

width	A numeric expression representing the horizontal spacing between gridlines, expressed in MeasurementUnits.

Remarks

The default horizontal spacing is 10 millimeters.


Landscape (Property)

See Also	Applies To

Sets or returns a value that determines the page orientation.

Syntax

Landscape [ = value] As Boolean

The Landscape syntax consists of the following parts:

Part	Description

value	A Boolean expression indicating whether the page orientation will be landscape.

Settings

The settings for Landscape are:

Value	Description

True	Landscape (the Horizontal dimension of the page is greater than the vertical dimension).

False	Portrait (the Vertical dimension of the page is greater than the horizontal dimension).

Remarks

This property can be changed by user in the PageSetup dialog. Notice that change of this property does not influence the  PageWidth and PageHeight properties.

The default value of this property is 'False'.


Height (Property)

See Also	Applies To

Sets or returns the page height.

Syntax

Height [ = height] As Long

The Height syntax consists of the following parts:

Part	Description

height	A numeric expression representing the paper height expressed in MeasurementUnits.

Remarks

This property can also be changed by the end-user in the PageSetup dialog.

The default page height is 297 millimeters (A4 paper dimension).


OriginX (Property)

See Also	Applies To

Returns the X-coordinate of the page's top-left corner with respect to the canvas origin (0,0). (The origin (0,0) is top-left corner of the canvas.)

Syntax

OriginX [ = position] As Long

The OriginX syntax consists of the following parts:

Part	Description

position	A numeric expression representing the X-coordinate of the page's top-left corner expressed in MeasurementUnits.

Remarks

This coordinate (together with the OriginY) represents the origin in all other properties, methods and events.

You can also change the page origin using the MoveOrigin method.


OriginY (Property)

See Also	Applies To

Returns the Y-coordinate of the page's top-left corner with respect to the origin (0,0). (The origin (0,0) is top-left corner of the canvas.)

Syntax

OriginY [ = position] As Long

The OriginY syntax consists of the following parts:

Part	Description

position	A numeric expression representing the Y-coordinate of the page's top-left corner expressed in MeasurementUnits.

Remarks

This coordinate (together with the OriginX) represents the origin in all other properties, methods and events.

You can also change the page origin using the MoveOrigin method.


Width (Property)

See Also	Applies To

Sets or returns the page width.

Syntax

Width [ = width] As Long

The Width syntax consists of the following parts:

Part	Description

width	A numeric expression representing the page width expressed in MeasurementUnits.

Remarks

This property can also be changed by the end-user in the PageSetup dialog.

The default page width is 210 millimeters (A4 paper dimension).


PaperColor (Property)

See Also	Applies To

Sets and returns the paper color.

Syntax

PaperColor [ = color] As OLE_COLOR

The PaperColor syntax consists of the following parts:

Part	Description

color	This value can be one of the normal RGB Colors. These colors are specified using the color palette, or by using the RGB or QBColor functions.

Remarks

The default value of this property is &H00FFFFFF& (White).


PaperOutlineColor (Property)

See Also	Applies To

Sets and returns the color of the paper outline.

Syntax

PaperOutlineColor [ = color] As OLE_COLOR

The PaperOutlineColor syntax consists of the following parts:

Part	Description

color	This value can be one of the normal RGB Colors. These colors are specified using the color palette, or by using the RGB or QBColor functions.

Remarks

The default value of this property is &H00000000& (Black).


PaperShadowColor (Property)

See Also	Applies To

Sets and returns the color of the paper shadow.

Syntax

PaperShadowColor [ = color] As OLE_COLOR

The PaperShadowColor syntax consists of the following parts:

Part	Description

color	This value can be one of the normal RGB Colors. These colors are specified using the color palette, or by using the RGB or QBColor functions.

Remarks

The default value of this property is &H00808080& (Gray).


PaperShadowOffset (Property)

See Also	Applies To

Sets and returns the offset of the paper shadow.

Syntax

PaperShadowOffset [ = offset] As Long

The PaperShadowOffset syntax consists of the following parts:

Part	Description

offset	A numeric expression representing the shadow offset expressed in pixels at 100% zoom.

Remarks

The Paper shadow offset is expressed in pixels at Zoom set to 100. (natural size). This means if this property is set to 23 pixels, the offset will be 23 pixels at Zoom = 100, and 46 pixels when Zoom = 200


VerticalGrid (Property)

See Also	Applies To

Sets or returns the vertical spacing between gridlines.

Syntax

VerticalGrid [ = height] As Long

The VerticalGrid syntax consists of the following parts:

Part	Description

height	A numeric expression representing the vertical spacing between gridlines, expressed in MeasurementUnits.

Remarks

The default vertical spacing is 10 millimeters.


HorGuidelines (Property)

See Also	Applies To

Returns the Guidelines collection that contains all horizontal guidelines. This property is read-only.

Syntax

HorGuidelines As Guidelines


VertGuidelines (Property)

See Also	Applies To

Returns the Guidelines collection that contains all the vertical guidelines. This property is read-only.

Syntax

VertGuidelines As Guidelines


Shapes (Property)

See Also	Applies To

Returns a Shapes collection that contains all the shapes on the page.

Syntax

Shapes As Shapes


Selection (Property)

See Also	Applies To

Returns a Selection collection that contains the current selection on the page.

Syntax

Selection As Selection


MoveOrigin (Method)

See Also	Applies To

Use this method to move the page origin respectively to its current position.

Syntax

Sub MoveOrigin(lX As Long, lY As Long)

The MoveOrigin method syntax consists of the following parts:

Part	Description

lX	A numeric expression representing the amount of horizontal offset expressed in MeasurementUnits.

lY	A numeric expression representing the amount of vertical offset expressed in MeasurementUnits.

Remarks

Use this method if you want to move the page origin respectively to its current position. If you want to specify the absolute coordinates of the page origin, use the OriginX and OriginY properties.


Guidelines (Collection Object)

See Also	Properties	Methods

The Guidelines collection includes the Guideline objects that are present in a page.

Remarks

The Guidelines collection can be retrieved from the Page object using the HorGuidelines or VertGuidelines property. The Guidelines collection retrieved using the HorGuidelines property presents only the horizontal guidelines, while the VertGuidelines property returns a collection of vertical guidelines.

Each Guideline object can be retrieved from this collection using the Item method by specifying the ordinal number of the guideline.


Add (Method)

See Also	Applies To

Use this method if you want to add a new guideline, specified by its position.

Syntax

Function Add(lPos As Long) As Guideline

The Add method syntax consists of the following:

Part	Description

lPos	A number that specifies the distance of the guideline from the top of the page, or from the left page margin, expressed in MeasurementUnits.

Remarks

If the Guidelines collection refers to a collection of horizontal guidelines, this method will add a new horizontal guideline, and the position lPos will represent the distance between the guideline and the top of the page. However, if it is in relation to vertical guides, lPos represents the distance from the page’s left margin.

Each guideline can be accessed by its index inside the collection of guidelines. Indexes are one-based. For example, the position of the third vertical guideline can be retrieved with the  Item(3) method, that is if the Guidelines collection represents a set of horizontal guidelines.

Note

If  you want the guidelines you have added to be visible, be sure to set the ShowGuidelines property to 'True' in advance.


DeleteAll (Method)

See Also	Applies To

Use this method if you want to remove all the Guideline objects contained in this collection.

Syntax

Sub DeleteAll()

Remarks

This method can be used to remove all the horizontal or vertical guidelines at once. If you want to delete one special guideline, you must apply the Delete method to that special Guideline object.

Example

For example, when you want to delete the third horizontal guideline:

Dim pd_HorGuides As POLARDRAW20Lib.Guidelines
Set pd_HorGuidelines = PolarDraw1.ActivePage.HorGuidelines
pd_HorGuidelines.Item(3).Delete


Guideline (Object)

See Also	Properties	Methods

The Guideline object represents one guideline on the page. It can be retrieved from the Guidelines collection.

Remarks

When you create a Guideline object, you can use its properties and methods in order to move it, set its new position or delete it.


Pos (Property)

See Also	Applies To

Sets and returns the position of the specific guideline.

Syntax

Pos[ = lPos ] As Long

Pos property syntax consists of the following parts:

Part	Description

lPos	A numeric expression that specifies the distance between the  guideline and one of the page margins (top or left), expressed in  MeasurementUnits

Remarks

This property represents the position of the guideline. The position is determined by just one coordinate because a guideline can be only horizontal or vertical. Therefor, the position represents the distance between the guide and the top, or left of the page respectively.


Move (Method)

See Also	Applies To

Use this method if you want to move the guideline.

Syntax

Sub Move(lOffset As Long)

Move method syntax consists of the following parts:

Part	Description

lOffset	A numeric expression that specifies the horizontal or vertical offset, expressed in  MeasurementUnits

Remarks

You can change the guideline’s position by changing the property Pos.However, using this method, enables you  to move the guideline respectively to its current position without knowing that current position.

The parameter lOffset represents the horizontal or vertical offset, depending on which guideline is moving (vertical or horizontal).


Shapes (Collection Object)

See Also	Properties	Methods

The Shapes object is a collection object containing all the shapes on an active page.

Remarks

You can retrieve this collection using the Shapes property of the Page object. To retrieve a specific shape from this collection, use one of these methods:

Item 	when you want to retrieve a shape with a specific position in the Z order

ItemFromID 	when you want to retrieve a shape with a specific ID

You can even retrieve a specific range of shapes from this object, by using the Range method

You can also use this object when you want to add new shapes to the drawing, delete all the shapes from the drawing, or select them all.


AddPolygon (Method)

See Also	Applies To

Use this method to add a custom polygon to the canvas.

Syntax

Function AddPolygon(lLeft As Long, lTop As Long, lRight As Long, lBottom As Long, xArray, yArray, fClosed As Boolean) As Shape

The AddPolygon method syntax consists of the following parts:

Part	Description

lLeft	A numeric expression that identifies the X-coordinate of the top-left corner of the bounding rectangle.

lTop	A numeric expression that identifies the Y-coordinate of the top-left corner of the bounding rectangle.

lRight	A numeric expression that identifies the X-coordinate of the bottom right- orner of the bounding rectangle.

lBottom	A numeric expression that identifies the Y-coordinate of the bottom-right corner of the bounding rectangle.

xArray	An array of VARIANTs, LONGs or INTs for the X-coordinates of the polygon nodes.

yArray	An array of VARIANTs, LONGs or INTs for the Y-coordinates of the polygon nodes.

fClosed	Defines whether the polygon is going to be closed. If this flag is set to 'True', One more node will be added to a shape, which will enable the polygon to be closed (First point is added to the end.).

Return value

Returns the Shape object that represents the created shape.

Remarks

Using the Add method you can add one of the predefined shapes, but to add a custom polygon, you must use this method.

lLeft, lTop, lRight and lBottom parameters define the rectangle that will bound the new polygon. (Bounding box) The placement of the polygon nodes is defined in the array specified by xArray and yArray. xArray and yArray are arrays of the polygon's node's coordinates, and they must contain the same number of elements.

Polygon nodes (elements of xArray and yArray) are relative to the bounding box. The coordinates are plotted within the bounding box of the polygon. The bounding box is divided into 65536 units and is scaled from 0 to 65535 for both the x and y dimensions. This means, if we want to place one of the polygon nodes at the left-top corner of the bounding box, it will have coordinates (0, 0), in the middle it will be (65535/2, 65535/2) = (32768,32768), and in the right-bottom corner, the coordinates must be (65535,65535).

A polygon must contain at least 2 different points. To make a closed polygon, the first and last nodes must have the same coordinates.

See Example below

Example

Visual Basic:

Dim xs, ys  As Variant

POLARDraw1.MeasurementUnits = polUnitsCentimeter

xs = Array(0, 32768, 65535, 32768, 0)

ys = Array(0, 16384, 65535, 49152, 0)

POLARDraw1.ActivePage.Shapes.AddPolygon 0, 0, 5, 5, (xs), (ys), True

Visual C++ (using MFC):

COleSafeArray xs, ys;

long lXs[5] = {0, 32768, 65535, 32768, 0};

long lYs[5] = {0, 16384, 65535, 49152, 0};

xs.CreateOneDim(VT_I4, 5, lXs) ;

ys.CreateOneDim(VT_I4, 5, lYs) ;

polardraw1.GetActivePage().GetShapes().AddPolygon(l, t, r, b, xs, ys, TRUE)

Or:

COleSafeArray xs, ys;

short lXs[5] = {0, 32768, 65535, 32768, 0};

  short lYs[5] = {0, 16384, 65535, 49152, 0};

xs.CreateOneDim(VT_I2, 5, lXs) ;

ys.CreateOneDim(VT_I2, 5, lYs) ;

polardraw1.GetActivePage().GetShapes().AddPolygon(l, t, r, b, xs, ys, TRUE)

Or:

COleSafeArray xs, ys;

VARIANT lXs[5] = {0, 32768, 65535, 32768, 0};

VARIANT lYs[5] = {0, 16384, 65535, 49152, 0};

lXs[0].vt = VT_I4 ili VT_I2 itd.

lXs[0].lVal = 0; ili lXs[0].iVal = 0;

lXs[1].vt = ...

...

...

xs.CreateOneDim(VT_VARIANT, 5, lXs);

ys.CreateOneDim(VT_VARIANT, 5, lYs);

polardraw1.GetActivePage().GetShapes().AddPolygon(l, t, r, b, xs, ys, TRUE)


AddConnection (Method)

See Also	Applies To

Use this method to add a connection between two shapes.

Syntax

Function AddConnection(HeadID As Long, TailID As Long) As Shape

The AddConnection method syntax consists of the following parts:

Part	Description

HeadID	A numeric expression that uniquely identifies the shape that will represent the source of the connection.

TailID	A numeric expression that uniquely identifies the shape that will represent the destination of the connection.

Return value

Returns the Shape object that represents the created shape. The created shape is a simple freeform object, with the Connectionobject defined.

Remarks

Use this method if you want to programmatically add a link inside. When you want to enable your users to link shapes, turn the EditMode to the polLink type.


AddText (Method)

See Also	Applies To

Use this method to add the text with the specified content.

Syntax

Function AddText(strText As String, Left As Long, Top As Long) As Shape

The AddText method syntax consists of the following parts:

Part	Description

strText	A string expression that defines the content of the text shape.

Left	A numeric expression that identifies the X-coordinate of the top-left corner of the text.

Top	A numeric expression that identifies the Y-coordinate of the top-left corner of the text.

Return value

Returns the Shape object that represents the created shape.

Remarks

A Text shape can be added as any other shape (See Add method), although the the string to be displayed as text must be set separately. That is why this method is useful. In one line of code, you can:

add the shape,

set its position

set its content.

The Size of the shape is determined by its font attributes and text content. You must set only one position (Top-left)


Add (Method)

See Also	Applies To

Use this method if you want to programmatically add a shape to the drawing

Syntax

Function Add(nType As polShapeType, lLeft As Long, lTop As Long, lRight As Long, lBottom As Long) As Shape

The Add method syntax has consists of the following parts:

Part	Description

nType	A numeric expression that determines the type of shape that will be added.

lLeft	A number that specifies the horizontal coordinate of the shape's top-left corner.

lTop	A number that specifies the vertical coordinate of the shape's top-left corner.

lRight	A number that specifies the horizontal coordinate of the shape's bottom-right corner.

lBottom	A number that specifies the vertical coordinate of the shape's bottom-right corner.

Settings

The settings for nType are here.

Return value

Returns the Shape object that represents the created shape.

Remarks

When you are adding  Plain Text, an empty string will be created (which will not be visible). After you added text, use the Text object of the created shape to set the text that is going to be displayed. The best way to add text to a shape is to use the AddText method.

polShapeType also contains a constant polFreeform. This type of shape cannot be added programmatically. To add a polygon programatically, use the AddPolygon method.


AddLine (Method)

See Also	Applies To

Use this method if you want to add a line to the drawing.

Syntax

Function AddLine(Left As Long, Top As Long, Right As Long, Bottom As Long) As Shape

The Add method syntax consists of the following parts:

Part	Description

Left	A numeric expression that identifies the X-coordinate of the top-left corner of the line.

Top	A numeric expression that identifies the Y-coordinate of the top-left corner of the line.

Right	A numeric expression that identifies the X-coordinate of the bottom-right corner of the line.

Bottom	A numeric expression that identifies the Y-coordinate of the bottom right corner of the line.

Return value

Returns Shape object that represents created shape.

Remarks

You can also add a line using the Add method, but the AddLine method adds a line by setting the beginning of line to (Left, Top) and the end of line to (Right, Bottom), while the Add method adds a line from left to right in a normalized bounding box determined by (Left, Top) and (Right, Bottom) (this means when you add the line using the Add method it will always have same orientation, no matter how you set the bounding box).


AddPicture (Method)

See Also	Applies To	Example

Use this method if you want to add a picture to the drawing.

Syntax

Function AddPicture(strFileName As String, Left As Long, Top As Long, Right As Long, Bottom As Long) As Shape

The AddPicture method syntax consists of the following parts:

Part	Description

strFileName	A string expression representing the full path and the filename of the picture.

Left	A numeric expression that identifies the X-coordinate of the top-left corner of the picture.

Top	A numeric expression that identifies  the Y-coordinate of the top left corner of the picture.

Right	A numeric expression that identifies the X-coordinate of the bottom-right corner of the picture.

Bottom	A numeric expression that identifies the Y-coordinate of the bottom bottom corner of the picture.

Return value

Returns the Shape object that represents the created shape.

Remarks

When you are adding a picture using the Add method, you have to add a rectangle and then fill it with picture. That is why this method is useful. You can do all of that with just one line of code.

The only limitation is that you can only add pictures with BMP or EMF extensions. For Visual Basic programmers this limitation is sidetracked using the AddPictureFromObj  method.


AddPictureFromObj (Method)

See Also	Applies To	Example

Use this method if you want to add a picture to the drawing.

Syntax

Function AddPictureFromObj(Picture As StdPicture,, Left As Long, Top As Long, Right As Long, Bottom As Long) As Shape

The AddPictureFromObj method syntax consists of the following parts:

Part	Description

Picture	The Picture object enables you to manipulate bitmaps, icons, metafiles, enhanced metafiles, GIF, and JPEG images assigned to objects having a Picture property.

Left	A numeric expression that identifies the X-coordinate of the top -left corner of the picture.

Top	A numeric expression that identifies the Y-coordinate of the top left corner of the picture.

Right	A numeric expression that identifies the X-coordinate of the bottom-right corner of the picture.

Bottom	A numeric expression that identifies the Y-coordinate of the bottom-right corner of the picture.

Return value

Returns the Shape object that represents the created shape.

Remarks

You can add a picture by adding a rectangle using the Add method, and then filling it with a picture. This method does that all by herself.


AddTextBox (Method)

See Also	Applies To

Use this method to add the text box with the specified content, RTF formatted.

Syntax

Function AddTextBox(strRTFText As String, Left As Long, Top As Long, Right As Long, Bottom As Long) As Shape

The AddTextBox method syntax consists of th following parts:

Part	Description

strRTFText	A string expression that defines the content of the text shape. Must be in RTF format

Left	A numeric expression that identifies the X-coordinate of the top-left corner of the text box.

Top	A numeric expression that identifies the Y-coordinate of the top-lef corner of the text box.

Right	A numeric expression that identifies the X-coordinate of the bottom-bottom corner of the text box.

Bottom	A numeric expression that identifies the Y-coordinate of the bottom-right corner of the text box.

Return value

Returns the Shape object that represents the created shape.

Remarks

The Text box can be added as any other shape (See Add method)although the string to be displayed as text must be formatted and set separately. That is why this method is useful. In one line of code, you can:

add the text box,

set its position

set its content.


SelectAll (Method)

See Also	Applies To

Selects all the shapes on the drawing.

Syntax

Sub SelectAll()

Remarks

The implication of this method execution is that the Count property of the Selection’s ShapeRange object will return the same value as the Count property of the Shapes collection. These two collections will contain the same shapes.


Range (Method)

See Also	Applies To	Example

Use this method if you want to retrieve a specific range of shapes. You can specify those shapes by their Z order positions, their IDs or using their names.

Syntax

Function Range([Index]) As ShapeRange

The Range method syntax consists of the following parts:

Part	Description

[Index]	Can be an array of strings, array of numbers, just one string or just one number (See Example)

Return value

Returns the ShapeRange collection which contains the specified shapes.

Remarks

This method is useful in several cases. Maybe you want to apply some formatting to a specific range of shapes, or you want to set some user limitations to several shapes e.g. do not move, do not rotate or do not select?

In previous versions of Polar Draw it was available to apply formatting to one shape, or all selected shapes at once. Using this method, you can create a new object ShapeRange, and apply formatting to all the specified shapes at once.


GetShapeOnPoint (Method)

See Also	Applies To	Example

Use this method to retrieve the shape at specific location.

Syntax

Function GetShapeOnPoint(lX As Long, lY As Long) As Object

The GetShapeOnPoint method syntax consists of the following parts:

Part	Description

lX	A numeric expression that identifies the X-coordinate of the new node.

lY	A numeric expression that identifies the Y-coordinate of the new node.

Return value

Returns the Shape at the specific point.

Remarks

Use this method if you want to get know which shape is at a  specific location. If there is more than one shape at specified location, this function will return the ID of the shape that is "on top".


Shape (Object)

See Also	Properties	Methods

A Shape object represents anything you can select with the pointer tool on a drawing canvas ie. an autoshape, curve, group, text...etc.

Remarks

You can retrieve a particular Shape's object from the Shapes collection or a ShapeRange collection. To retrieve objects that represent a particular formation, choose some of the following properties: Fill, Line, Arrows, Lens, Shadow, Hyperlink, Text, Vertices, Lock, and others.


Left (Property)

See Also	Applies To

Sets and returns the position of the object’s left border.

Syntax

Left [ = number] As Long

The Left syntax consists of the following parts:

Part	Description

number	A numeric expression representing the position of the border, expressed in MeasurementUnits.

Remarks

This property returns different values for just one shape or range of shapes.

The Left border of the single shape remains the same no matter if the shape is rotated and if the current position of the left most node of the shape is not at exactly the same position.

The Left property of the range of shapes is the current left border of the bounding box that contains all the shapes from the range.

Setting this property to a specific value will resize the shape (and each shape in range). It will change the shape’s width by setting its left border to the predefined position. (number).


Bottom (Property)

See Also	Applies To

Sets and returns the  position of the object’s bottom border.

Syntax

Bottom [ = number] As Long

The Bottom syntax consists of the following parts:

Part	Description

number	A numeric expression representing the position of the border, expressed in MeasurementUnits.

Remarks

This property returns the different values for just one shape or range of shapes.

The Bottom border of the single shape remains the same no matter if the shape is rotated and if the current position of the bottom node of the shape is not at exactly  the same position.

The Bottom property of the range of shapes is the current bottom border of the bounding box that contains all  the shapes from the range.

Setting this property to specific value will resize shape (and each shape in range). It will change shape’s height by setting its bottom border to the predefined position. (number).


Right (Property)

See Also	Applies To

Sets and returns the position of the object’s right border.

Syntax

Right [ = number] As Long

The Right syntax consists of the following parts:

Part	Description

number	A numeric expression representing the position of the border, expressed in MeasurementUnits.

Remarks

This property returns different values for just one shape and for range of shapes.

The Right border of the single shape remains the same, no matter if the shape is rotated and if the current position of the shape’s right most node is not exactly at the same position.

The Right property of the range of shapes is the current right border of the bounding box that contains all the shapes from the range.

Setting this property to a specific value will resize the shape (and each shape in range). It will change the shape’s width by setting its right border to the predefined position. (number).


Top (Property)

See Also	Applies To

Sets and returns the position of the object’s top border.

Syntax

Top [ = number] As Long

The Top syntax consists of the following parts:

Part	Description

number	A numeric expression representing the position of the border, expressed in MeasurementUnits.

Remarks

This property returns different values for just one shape or range of shapes.

The Top border of the single shape remains the same no matter if the shape is rotated and if the current position of the shape‘s top node is not at exactly the same position.

The Top property of the range of shapes is the current top border of the bounding box that contains all the shapes from the range.

Setting this property to a specific value will resize the shape (and each shape in range). It will change the shape’s height by setting its top border to the predefined position. (number).


Rotation (Property)

See Also	Applies To

Sets and returns the angle (lAngle) between the current shape’s position and the shape's original position.

Syntax

Rotation[ = lAngle] As Long

Rotation property syntax consists of the following parts:

Part	Description

lAngle	Numeric expression representing the angle expressed in degrees.

Remarks

The Rotation is performed around each shape's center. The difference between setting this property and the Rotate method is the start angle. This property performs the rotation from the shape's original position, while Rotate performs the rotation from its current position.


HasLens (Property)

See Also	Applies To	Example

Sets and returns the flag that indicates whether the object performs lens effects.

Syntax

HasLens [ = bNewValue] As Boolean

The HasLens syntax consists of the following parts:

Part	Description

bNewValue	A Boolean expression indicating whether theobject performs lens effects.

Remarks

When you decide to make visible the lens' properties that you have set in the Lens object, set this property to 'True'.


HasLine (Property)

See Also	Applies To	Example

Sets and returns the flag that indicates whether the shape or group of shapes have an outline.

Syntax

HasLine [ = bNewValue] As Boolean

The HasLine syntax consists of the following parts:

Part	Description

bNewValue	A Boolean expression indicating whether the shape(s) outline is visible.

Remarks

By default, every shape is created with visible outlines. If you decide to hide the outline and than to show it again with a different format, do not forget to set the HasLine flag to 'True' again.


HasShadow (Property)

See Also	Applies To	Example

Sets and returns the flag that indicates whether the shape’s shadow will be drawn.

Syntax

HasShadow [ = bNewValue] As Boolean

The HasShadow syntax consists of the following parts:

Part	Description

bNewValue	A Boolean expression indicating whether the shape(s) shadow is visible.

Remarks

Make sure the HasShadow flag is set to 'True' every time you want to apply one of the Shadow settings.


IsFilled (Property)

See Also	Applies To	Example

Sets and returns the the flag that indicates whether the shapes will be filled.

Syntax

IsFilled[ = bNewValue] As Boolean

The IsFilled syntax consists of the following parts:

Part	Description

bNewValue	A Boolean expression indicating whether the shape(s) will be filled.

Remarks

Make sure the IsFilled flag is set to 'True' every time you want to apply one of the Fill effects.


PortCount (Property)

See Also	Applies To	Example

Returns the number of connection points in an object.

Syntax

PortCount [ = number] As Long

The PortCount syntax consists of the following parts:

Part	Description

number	Number expression representing the number of ports.polygon.

Remarks

When connecting two shapes, there is a limited number of points on each shape that can be connected. Those connection points are called ports. Each shape has a different number of connection points. For polygons, for example, a port can be each polygon node and center as well.

This property is read-only and you should use it whenever you want to retrieve information about how many connection ports that particular shape has.


Connections (Property)

See Also	Applies To	Example

Returns a ShapeRange collection that contains all the shapes that represent links with other shapes. Those shapes have Connection properties. This property is read-only.

Syntax

Connections As Object


Height (Property)

See Also	Applies To

Sets or returns the height of the shape.

Syntax

Height [ = height] As Long

The Height syntax consists of the following parts:

Part	Description

height	A numeric expression representing the  height expressed in MeasurementUnits.

Remarks

This value is changing when the user resizes a shape or when you change Top or Bottom property.


Width (Property)

See Also	Applies To

Sets or returns the width of the shape.

Syntax

Width [ = width] As Long

The Width syntax consists of the following parts:

Part	Description

width	A numeric expression representing the width expressed in MeasurementUnits.

Remarks

This value changes when the user resizes a shape or when you change the Left or Right property.


ID (Property)

See Also	Applies To

Returns the ID of the shape.

Syntax

ID [ = number] As Long

The ID syntax consist of the following parts:

Part	Description

number	A numeric expression that uniquely identifies a shape.

Remarks

The shape’s ID is a number that uniquely identifies a shape. You can retrieve a single shape from the range of shapes by using its position in the Z order, or by this ID. This property is read-only.


IsHidden (Property)

See Also	Applies To

Sets and returns the flag that indicates whether the shape’s will be shown on the drawing.

Syntax

IsHidden [ = fNewValue] As Boolean

The IsHidden property syntax consists of the following parts:

Part	Description

bNewValue	A Boolean expression indicating whether the shape(s) will be hidden or not.

Remarks

You can choose to hide a shape on the drawing and show it when you are trying to simulate some animation. This property is also useful if you want to offer the end-user your own predefined shape. Draw the shape and hide it on the drawing. When the user chooses to add that shape, just make a copy of the shape that exists on the drawing, but is not visible to the user.


IsLink (Property)

See Also	Applies To	Example

Returns the flag that indicates whether the specific shape is a link between two other shapes.

Syntax

IsLink[ = fNewValue]As Boolean

The IsLink property syntax consists of the following parts:

Part	Description

bNewValue	A Boolean expression indicating whether a shape is a link or not.

Remarks

This property is read-only. Shapes that represent connections between two other shapes have this property set to 'True', and you can retrieve the Connection object from them.


Name (Property)

See Also	Applies To	Example

Sets or gets the name assigned to the shape.

Syntax

Name [ = name] As String

Name property syntax consists of the following:

Part	Description

name	String expression.

Remarks

You can use this property to give a name to a shape, or to store here any comment that will be assigned to a shape.

Different shapes CANNOT have identical names, so this property can be used to uniquely identify the shape.

You can also use this property to set the range of shapes, using the Range method.

The default name for each shape is “Shape#” where # represents the shape’s ID.


Type (Property)

See Also	Applies To	Example

Returns the number specifying the shape’s type.

Syntax

Type [ = number] As polShapeType

Type property syntax consists of the following parts:

Part	Description

number	Constant representing the shape type.

Remarks

When converting shapes to curves, their type is also changing.

For example, before converting the rectangle to curve, the Type property will return polRectangle, but after conversion, it will return polFreeform constant as shape type.


ZPos (Property)

See Also	Applies To Example

Returns the position of the specified shape in the z-order.

Syntax

ZPos [ = number] As Long

ZPos property syntax consists of the following parts:

Part	Description

number	Number representing the position in the z-order.

Remarks

The Shape with the Zpos = 1 is the shape at the back of the z-order while the  Shape with the Zpos = Shapes.Count returns the shape at the front of the z-order. This property is read-only.

To set the shape's position in the z-order, use the ZOrder method.

A shape's position in the z-order corresponds to the shape's index number in the Shapes collection. For example, if there are four shapes on the pd_Page, the expression pd_Page.Shapes.Item(1) returns the shape at the back of the z-order, and the expression pd_Page.Shapes.Item (4) returns the shape at the front of the z-order.

Whenever you add a new shape to a collection, it is added to the front of the z-order by default.


RotateAroundPoint (Method)

See Also	Applies To

Use this method when you want to rotate an object by a specific angle (lAngle) around a specific point.

Syntax

Sub RotateAroundPoint(lAngle As Long, lX As Long, lY As Long)

The RotateAroundPoint method syntax consists of the following parts:

Part	Description

lAngle	Numeric expression representing the angle expressed in degrees.

lX	A number that specifies x-coordinate of the rotation center expressed in MeasurementUnits.

lY	A number that specifies y-coordinate of the rotation center, expressed in MeasurementUnits.

Remarks

Shape will be rotated around (lX, lY) point.


Rotate (Method)

See Also	Applies To

Use this method when you want to rotate an object by a specific angle (lAngle).

Syntax

Sub Rotate (lAngle As Long)

The Rotate method syntax consists of the following parts:

Part	Description

lAngle	Numeric expression representing the angle expressed in degrees.

Remarks

If you apply this method to a specific shape, it will be rotated around its center. If you apply this method to the ShapeRange object, each shape in the shape range will be rotated around its center.

If you want to perform a rotation around a specified point, use the RotateAroundPoint method.


AddHyperlink (Method)

See Also	Applies To	Example

Use this method when you want to add a hyperlink feature to the shape or range of shapes.

Syntax

Function AddHyperlink() As Hyperlink

Return value

Returns a Hyperlink object which describes a hyperlink associated with the shape(s). This object can also be retrieved using the Hyperlink property.

Remarks

This method is used to create a Hyperlink object which will describe hyperlink associated with the specified shape or range of shapes.


AddToSelection (Method)

See Also	Applies To

Use this method when you want to add shape, or range of shapes to the current selection.

Syntax

Sub AddToSelection()

Remarks

Use this method if you want to add a specific shape(s) to the already existing selection. To clear an existing selection and create a new one with those shape(s) use the method Select.


Select (Method)

See Also	Applies To

Use this method when you want to select a shape or range of shapes.

Syntax

Sub Select()

Remarks

This method will clear the current selection and create a new one which will contain shape(s) you applied this method to. If you want to keep the current selection, then use the method AddToSelection.


Move (Method)

See Also	Applies To

Use this method when you want to move a shape or range of shapes.

Syntax

Sub Move(lX As Long, lY As Long)

The Move method syntax consists of the following parts:

Part	Description

lX	Numeric expression representing the horizontal offset expressed in MeasurementUnits.

lY	Numeric expression representing the vertical offset expressed in MeasurementUnits.

Remarks

Use this method when you want to move a specific shape or range of shapes relatively to its current position.


Ungroup (Method)

See Also	Applies To

Ungroups any grouped shapes in the specified shape or range of shapes.

Syntax

Sub Ungroup(fUngroupAll As Boolean)

The Ungroup method syntax consists of the following parts:

Part	Description

fUngroupAll	A Boolean expression that determines whether the shape(s) will be ungrouped for just one step or if it will be ungrouped to the besic elements.

Remarks

A group of shapes can contain other groups, so use the fUngroupAll flag to determine if you want all groups to be ungrouped or to ungroup just one step.

All formatting that you apply to a specific group of shapes will remain on each shape after ungrouping.

If Z-order did not change since those shapes were grouped, after ungrouping, those shapes will get a Z-position same as the element from the group which had the smallest z-position before grouping. If Z-order of other shapes changed between grouping and ungrouping, ungrouped shapes will have the biggest z-position of all shapes, but they will remain in the same order as before grouping.

Because a group of shapes is treated as a single object, grouping and ungrouping shapes changes the number of items in the Shapes collection and changes the index numbers of items that come after the affected items in the collection.


ZOrder (Method)

See Also	Applies To

Moves the specified shape(s) in front of or behind other shapes in the collection (that is, changes the shape's position in the z-order).

Syntax

Sub ZOrder(lCommand As polZOrderCmd)

The ZOrder method syntax consists of the following parts:

Part	Description

lCommand	Specifies where to move the specified shape relative to the other shapes. See Settings.

Settings

polZOrderCmd	Description

polSendToBack = 0	Moves object directly to the bottom of the stack.

polSendBackward = 1	Moves object one place in the direction of the bottom of the stack.

polBringForward = 2	Moves object one place in the direction of the top of the stack.

polBringToFront = 3	Moves object directly to the top of the stack.

Remarks

Use the ZPos property to determine a shape's current position in the z-order.

Note

When you apply this method to the ShapeRange, the shapes in range will remain in the same relative order. When sending ShapeRange one step back, they will all go back one step behind the shape in range with the smallest z-position. When sending ShapeRange one step front, they will all go in one step in front of the shape in range with the biggest z-position.


ConvertToPolygon (Method)

See Also	Applies To

Use this method when you want to convert the auto shape or text to polygon.

Syntax

Function ConvertToPolygon() As Boolean

Return value

True	Conversion succeeded

False	Conversion failed

Remarks

Use this method if you want to edit the points of predefined shapes.

Auto shapes and plain text are not available for editing when the EditMode is set to polEditPoints, because their nodes are fixed. After applying this method, those shapes will be converted to polygons and their nodes can be edited. The type property of those shapes is also changed to polFreeform.

Note

When you apply this method to an ellipse, it will be converted to a curve. To convert it to a polygon, you must apply this method again.


Duplicate (Method)

See Also	Applies To

Use this method when you want to create a copy of the shape.

Syntax

Function Duplicate() As Object

Return value

Returns the Shape object which represents a copy of the specified shape.

Remarks

Using this method, a new shape is created which is identical to the shape you applied this method to.


GetPortPosition (Method)

See Also	Applies To	Example

Retrieves coordinates of the specific connection port.

Syntax

Function GetPortPosition(lPortID As Long, lX As Long, lY As Long) As Boolean

The GetPortPosition method syntax consists of the following parts:

Part	Description

lPortID	Numeric expression representing a number that uniquely identifies a connection port.

lX	X coordinate of the port expressed in MeasurementUnits.

lY	Y coordinate of the port expressed in MeasurementUnits.

Return value

Method returns Boolean expression:

True	Method was executed successfully

False	Method failed; or specific port does not exist

And sets coordinates of the port through lX and lY values:

lX	X coordinate of the port expressed in MeasurementUnits.

lY	Y coordinate of the port expressed in MeasurementUnits.

Remarks

When you want to retrieve coordinates of a specific port, use this method. The coordinates will be retrieved through the lX and lY values.


SetPos (Method)

See Also	Applies To

Sets the position and new dimensions of the specific shape, or range of shapes.

Syntax

Sub SetPos(Left As Long, Top As Long, Right As Long, Bottom As Long)

The SetPos method syntax consists of the following parts:

Part	Description

Left	X coordinate of the left-top corner, expressed in MeasurementUnits.

Top	Y coordinate of the left-top corner, expressed in MeasurementUnits.

Right	X coordinate of the right-bottom corner, expressed in MeasurementUnits.

Bottom	Y coordinate of the right-bottom corner, expressed in MeasurementUnits.

Remarks

Use this method if you want to move a specified shape to the specific position. At the same time, you can resize a shape specifying position of its top-left and the right-bottom corner. This method simply changes properties Left, Top, Right and Bottom at once.


Manipulating Polygons Programmatically (Example)

This example shows how to programmatically manipulate polygons:***

Dim xs, ys  As Variant

POLARDraw1.MeasurementUnits = polUnitsCentimeter

xs = Array(0, 32768, 65535, 32768, 0)

ys = Array(0, 16384, 65535, 49152, 0)

POLARDraw1.AddPolygon 0, 0, 5, 5, (xs), (ys), True


Formatting Font Attributes (Example)

Here is an example how to format the font attributes before Setting the PlainText property to  all selected shapes:

Private Sub btnSetPlain_Click()

Dim pd_ShapeRange As POLARDRAW20Lib.ShapeRange

Set pd_ShapeRange = POLARDraw1.ActivePage.Selection.ShapeRange

With pd_ShapeRange.Text.Font

.Name = "Arial"

.Bold = True

.Italic = False

.Underline = True

.Size = 12

End With

pd_ShapeRange.Text.Plain = "Just Simple formatted text: Arial, Size = 12, Bold, Underline"

End Sub


Adding and Activating Hyperlink (Example)

The following example activates the hyperlink associated with the shape which has been clicked.

Private Sub btnAddHyperlink_Click()

POLARDraw1.HyperlinkBase = txtBase

pd_selection.ShapeRange.AddHyperlink

With pd_selection.ShapeRange.Hyperlink

.Address = txtAddress

.ExtraInfo = txtExtra

.ShowHandCursor = chckShowHand.Value

End With

End Sub

Private Sub POLARDraw1_HyperlinkClicked(ByVal lShapeID As Long, ByVal nButton As Integer, ByVal nMask As Integer)

If pd_shapes.ItemFromID(lShapeID).IsLink = True Then Exit Sub

    With pd_shapes.ItemFromID(lShapeID)

      .Hyperlink.Follow

      'formatting to 'visited' color

      .Fill.Color = RGB(244, 155, 173)

   End With

End Sub


Setting Environment (Example)

This is a sample of how to create a function that will set some of the Environment properties. pd_Environment is a Polardraw20Lib.Environment object.

Public pd_Environment As POLARDRAW20Lib.Environment

Private Sub SetEnvironment()

Set pd_Environment = POLARDraw1.ActiveWindow.Environment

With pd_Environment

.EditMode = polResize

.RulerMeasurementUnits = polUnitsMilimeter

.ShowHorizontalRuler = True

.ShowHorizontalScrollBar = True

.ShowVerticalRuler = True

.ShowVerticalScrollBar = True

.ShowGrid = False

.allow

End With

pd_Window.CenterPage

End Sub


Formatting Arrows (Example)

Here is an example of how to format the arrows of the link shapes:

If pd_shapes.Count > 0 Then

For Each element In pd_shapes

If element.IsLink = True Then

With element.Arrows

.EndType = polStealthArrow

.EndWidth = polNarrowArrow

.EndLength = polLongArrow

End With

End If

Next

End If


Retrieving Connection Info (Example)

Here is an example how to retrieve information about the link between two shapes:

Private Sub btnLinkInfo_Click()

If pd_Selection.ShapeRange Is Nothing Or pd_Selection.ShapeRange.Count <> 1 Then Exit Sub

Dim pd_SelectedShape As POLARDRAW20Lib.Shape

Set pd_SelectedShape = pd_Selection.ShapeRange(1)

LinkInfo (pd_SelectedShape.ID)

Set pd_SelectedShape = Nothing

End Sub

Private Sub LinkInfo(lShapeID As Long)

Dim pd_shape As POLARDRAW20Lib.Shape

Set pd_shape = POLARDraw1.ActivePage.Shapes.ItemFromID(lShapeID)

If pd_shape.IsLink = True Then

Set pd_conn = pd_shape.Connection

If pd_conn Is Nothing Then

MsgBox "Error: pd_conn is Nothing!", vbCritical

Else

Dim strInfo As String

strInfo = "Link: " + pd_shape.Name

'check whether source of connection exists

If pd_conn.Source Is Nothing Then

strInfo = strInfo + Chr(10) + Chr(13) + "Source Shape: There's no source"

Else

strInfo = strInfo + Chr(10) + Chr(13) + "Source Shape: " + pd_conn.Source.Name + Chr(10) + Chr(13) + "Source Port: " + CStr(pd_conn.SourcePort)

End If

'check whether destination of connection exists

If pd_conn.Destination Is Nothing Then

strInfo = strInfo + Chr(10) + Chr(13) + "Destination Shape: There's no destination"

Else

strInfo = strInfo + Chr(10) + Chr(13) + "Destination Shape: " + pd_conn.Destination.Name + Chr(10) + Chr(13) + "Destination Port: " + CStr(pd_conn.DestinationPort)

End If

MsgBox strInfo

Set pd_conn = Nothing

End If	'end if pd_conn Is Nothing

Else  	'if pd_shape is link

MsgBox "Error: Shape is not a link!", vbCritical

End If	'if pd_shape is link

Set pd_shape = Nothing

End Sub


Inserting Pictures in Polar Draw (Example)

This example shows how to fill the existing shape with a picture, adjust the shape’s size to the picture size and keep those steps invisible to the user.

Private Sub File1_Click()

'Selection of picture in File1 FileListBox causes

'viewing that picture in POLARDraw window.

   Dim string1 As String

   Let string1 = Dir1.Path

   If Len(string1) > 3 Then

      Let string1 = string1 & "\"

   End If

   Label1.Caption = "Picture: " & string1 & File1.FileName

   On Error GoTo res

   Set Pic = LoadPicture(string1 & File1.FileName)

   POLARDraw1.EnableRendering = False

   'Positions of Shape borders are set to dimensions of selected picure.

   'Top and Left borders of shape are fixed.

   Shape.Right = Shape.Left + Pic.Width

   Shape.Bottom = Shape.Top + Pic.Height

   Shape.Select

   'Active window is set to fit to selection. Zoom is also updated by FitTo method.

   POLARDraw1.ActiveWindow.FitTo polFitToSelection

POLARDraw1.ActivePage.Selection.Clear

   UpdateZoom

   Shape.IsFilled = True

   Shape.Fill.SetPictureFromObject Pic

'now re-draw changes

   POLARDraw1.EnableRendering = True

   POLARDraw1.Render

   Exit Sub

res:

   POLARDraw1.EnableRendering = True

   Shape.IsFilled = False

End Sub


Open/Save Picture (Example)

This is an example of how to open and save the Polar Draw pictures to the disk, and how to catch the error messages using the ErrorReadingFile and ErrorWritingFile events:

Private Sub mnuOpen_Click()

    POLARDraw1.Read OpenPDRFile("Polar Draw Files (*.pdr)" + Chr(0) + "*.pdr" + Chr(0) + "All Files (*.*)" + Chr(0) + "*.*")

End Sub

Private Sub mnuSave_Click()

    POLARDraw1.Write SavePDRFile("Polar Draw Files (*.pdr)" + Chr(0) + "*.pdr" + Chr(0) + "All Files (*.*)" + Chr(0) + "*.*"), 1

End Sub

Private Sub POLARDraw1_ErrorReadingFile(ByVal szErrorMsg As String, ByVal lErrorCode As Long, pbIgnore As Boolean)

    MsgBox szErrorMsg, vbCritical, "Polar Draw ActiveX Control"

    pbIgnore = True

End Sub

Private Sub POLARDraw1_ErrorWritingFile(ByVal szErrorMsg As String, ByVal lErrorCode As Long, pbIgnore As Boolean)

    MsgBox szErrorMsg, vbCritical, "Polar Draw ActiveX Control"

    pbIgnore = True

End Sub

Public Function OpenPDRFile(strFilter) As String

'This functiom calls Windows API which displays dialog Open

Dim fnFileName As OPENFILENAME

    With fnFileName

        .lStructSize = Len(fnFileName)

        .hwndOwner = 0

        .lpstrDefExt = "*.pdr"

        .nMaxFile = 256

        .lpstrFilter = strFilter

        .lpstrFile = String(255, " ")

    End With

    If GetOpenFileName(fnFileName) Then

        fnFileName.lpstrFile = RTrim(fnFileName.lpstrFile)

        OpenPDRFile = fnFileName.lpstrFile

    End If

End Function

Public Function SavePDRFile(strFilter) As String

'This functiom calls Windows API which displays dialog Save As

Dim fnFileName As OPENFILENAME

    With fnFileName

        .lStructSize = Len(fnFileName)

        .hwndOwner = 0

        .lpstrDefExt = "*.pdr"

        .nMaxFile = 256

        .lpstrFilter = strFilter

        .lpstrFile = String(255, " ")

    End With

    If GetSaveFileName(fnFileName) Then

        fnFileName.lpstrFile = RTrim(fnFileName.lpstrFile)

        SavePDRFile = fnFileName.lpstrFile

    End If

End Function


Formatting Fill Attributes (Example)

Here is an example of how to apply new fill attributes to the current selection:

If pd_selection.ShapeRange.Count > 0 Then

With pd_selection.ShapeRange

.Fill.Type = polPattern

.Fill.Color = vbBlue

.Fill.BackColor = vbWhite

.Fill.Pattern = pol30Percent

.IsFilled = True

End With

End If


Formatting Line Attributes (Example)

Here is an example of how to apply new line attributes to the current selection:

If pd_selection.ShapeRange.Count > 0 Then

With pd_selection.ShapeRange

.Line.DashStyle = polDash_Dot_Dot

.Line.Color = vbGreen

.Line.Width = 3

.HasLine = True

End With

End If


Formatting Shadow Attributes (Example)

Here is an example of how to apply new line attributes to the current selection:

If pd_selection.ShapeRange.Count > 0 Then

With pd_selection.ShapeRange

.Shadow.OffsetX = .Shadow.OffsetY = 5

.Shadow.Color = vbCyan

.Shadow.Type = polDoubleOffShadow

.HasShadow = True

End With


Adding Background Picture (Example)

Here is an example of how to add a picture as the background of the paper:

Set pd_shapes = POLARDraw1.ActivePage.Shapes

Set pd_background = pd_shapes.AddPictureFromObj(LoadPicture("background.jpg"), 0, 0, 100, 100)

‘set the lock properties to enable the end user of editing the picture

With pd_background

.Lock.AgainstRotation = True

.Lock.AgainstSelection = True

End With


Conversion of Coordinates on MouseDown Event (Example)

This is an example of how to catch the shape currently under the mouse while the user moves the mouse over the canvas. When the user presses Ctrl and drags the mouse over the shape, the shape becomes red.

Private Sub PolarDraw_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)

If Shift <> vbCtrlMask Then Exit Sub

Dim x1 As Long	'mouse coordinate

Dim y1 As Long	'mouse coordinate

Dim shapeID As Long

Dim old_units As Long

Dim pd_shape As POLARDRAW20Lib.Shape

x1 = x

y1 = y

old_unit = POLARDraw.MeasurementUnits	'remembering old units

POLARDraw.MeasurementUnits = polUnitsTwips

'setting Measurement Units
'to twips, because x and y
'are expressed in twips

POLARDraw.ActiveWindow.UnitsToPixels x1, y1

'converting units to pixels because WindowToPage method

'receives parameters expressed in pixels

POLARDraw.MeasurementUnits = old_unit

'returning old units back

POLARDraw.ActiveWindow.WindowToPage x1, y1

'calculating position
'of the mouse pointer
'in respect to the page

If POLARDraw1.ActivePage.GetShapeOnPoint(x1, y1) Is Nothing Then Exit Sub

Set pd_shape = POLARDraw1.ActivePage.GetShapeOnPoint(x1, y1)

pd_shape.Fill = vbRed

Set pd_shape = Nothing

End Sub


Creating Shortcuts (Example)

This is an example of how to catch the key down events and set hot keys:

Private Sub POLARDraw1_KeyDown(KeyCode As Integer, Shift As Integer)

  If Shift = vbCtrlMask Then

        Select Case KeyCode

            Case vbKeyR

                pd_environment.EditMode = polResize

            Case vbKeyC

                pd_environment.EditMode = polCreateNew

        End Select

    End If

End Sub


Changing Format of Newly Added Shapes (Example)

When you (or the end-users) add the new shape to the canvas, it is filled with a white solid color and outlined with a black solid line. If you want to change this default formatting, use the BeforeShapeAdded and ShapeAdded events to simulate the ‘default’ format:

Private Sub POLARDraw1_BeforeShapeAdded(ByVal fProgramatically As Boolean, ByVal lShapeID As Long)

   POLARDraw1.EnableRendering = False

   With pd_shapes.ItemFromID(lShapeID)

      .Fill.Type = polShade

      .Fill.Color = vbRed

      .Fill.BackColor = vbWhite

      .Fill.GradientAngle = 45

      .IsFilled = True

      .HasLine = False

   End With

End Sub

Private Sub POLARDraw1_ShapeAdded(ByVal fProgramatically As Boolean, ByVal lShapeID As Long)

   POLARDraw1.EnableRendering = True

   POLARDraw1.Render

End Sub


Adding and Editing Polygons (Example)

Here is an example of how you can edit polygon points:

Private Sub btnVerticesInfo_Click()

'this sub displays message box with information

'about the position of selected polygon vertices

If pd_selection.ShapeRange.Count <> 1 Then Exit Sub

If pd_selection.ShapeRange(1).Type <> polFreeform Then

   MsgBox "You must select a polygon!", vbCritical

   Exit Sub

End If

Dim pd_vertices As POLARDRAW20Lib.Vertices

Set pd_vertices = pd_selection.ShapeRange(1).Vertices

   Dim strInfo As String

   strInfo = ""

   Dim i As Integer

   i = 0

   For Each element In pd_vertices

   i = i + 1

       strInfo = strInfo + "Index: " + CStr(element.Index) + "    x= " + CStr(element.x) + "    y= " + CStr(element.y) + Chr(10) + Chr(13)

   Next

   MsgBox strInfo

   Set pd_vertices = Nothing

End Sub

Private Sub btnAddToEnd_Click()

'this sub adds one more vertex to the selected polygon

'new vertex is going to be inserted after the last one,

'and it's going to be positioned 10000 relative units left

'and up from the last vertex

If pd_selection.ShapeRange.Count <> 1 Then Exit Sub

If pd_selection.ShapeRange(1).Type <> polFreeform Then

   MsgBox "You must select a polygon!", vbCritical

   Exit Sub

End If

Dim pd_vertices As POLARDRAW20Lib.Vertices

Set pd_vertices = pd_selection.ShapeRange(1).Vertices

With pd_vertices

   .Add .Item(.Count).x + 10000, .Item(.Count).y + 10000

End With

Set pd_vertices = Nothing

End Sub

Private Sub btnRemoveLast_Click()

'this sub removes last vertex of the selected polygon

If pd_selection.ShapeRange.Count <> 1 Then Exit Sub

If pd_selection.ShapeRange(1).Type <> polFreeform Then

   MsgBox "You must select a polygon!", vbCritical

   Exit Sub

End If

Dim pd_vertices As POLARDRAW20Lib.Vertices

Set pd_vertices = pd_selection.ShapeRange(1).Vertices

   With pd_vertices

      .Item(.Count).Delete

   End With

End Sub


Text Formatting (Example)

Here is an example of how to change the font formatting of a newly added shape if you do not prefer default formatting.

Private Sub POLARDraw1_BeforeShapeAdded(ByVal fProgramatically As Boolean, ByVal lShapeID As Long)

Dim pd_font As POLARDRAW20Lib.Font

Set pd_font = POLARDraw1.ActivePage.Shapes.ItemFromID(lShapeID).Text.Font

POLARDraw1.EnableRendering = False

With pd_font

.Name = "Arial"

.Italic = True

.Size = 10

End With

POLARDraw1.EnableRendering = True

POLARDraw1.Render

Set pd_font = Nothing

End Sub


Formatting Lens Attributes (Example)

Here is an example of how to apply new lens attributes to the current selection:

If pd_selection.ShapeRange.Count > 0 Then

            With pd_selection.ShapeRange

               .Lens.BackColor = vbGreen

               .Lens.Color = vbYellow

               .Lens.Type = polCustomPalette

               .HasLens = True

            End With


Determine the Shape Type (Example)

The following code shows how you can determine and display the shape’s type:

Public arr_ShapeTypeConstants As Variant

Public arr_ShapeTypeNames As Variant

Public Sub SetShapeTypes()

arr_ShapeTypeConstants = Array(polArc, polDiamond, polDimensionBar, polEllipse, polFreeform, polHexagon, polIsoscelesTriangle, polLeftArrow, polLine, polLink, polOctagon, polParallelogram, polPentagon, polPlainText, polPlusSign, polRectangle, polRightTriangle, polRoundRectangle, polStar, polTextBox, polTrapezoid)

arr_ShapeTypeNames = Array("Arc", "Diamond", "Dimension Bar", "Ellipse", "Freeform", "Hexagon", "Isosceles Triangle", "Left Arrow", "Line", "Link", "Octagon", "Parallelogram", "Pentagon", "Plain Text", "Plus Sign", "Rectangle", "Right Triangle", "Round Rectangle", "Star", "Text Box", "Trapezoid")

End Sub

Function GetShapeType(lShapeID As Long) As Long

For i = 1 To 20

If pd_Shapes.ItemFromID(lShapeID).Type = arr_ShapeTypeConstants(i) Then

MsgBox arr_ShapeTypeNames(i)

GetShapeType = arr_ShapeTypeConstants(i)

Exit Function

End If

Next i

End Function

Private Sub POLARDraw1_ShapeClicked(ByVal lShapeID As Long, ByVal nButton As Integer, ByVal nMask As Integer)

GetShapeType lShapeID

End Sub


Retrieving Ports Info (Example)

Here is an example of how to retrieve information about all the ports on one shape:

Private Sub btnPortPosition_Click()

   Dim i As Long

   Dim pd_SelectedShape As POLARDRAW20Lib.Shape

   Dim strInfo As String

   Set pd_SelectedShape = pd_Selection.ShapeRange(1)

   If pd_SelectedShape Is Nothing Then Exit Sub

   strInfo = "Selected shape has " + CStr(pd_SelectedShape.PortCount) + " ports."

   For i = 1 To pd_SelectedShape.PortCount

      Dim XPos As Long, YPos As Long

      pd_SelectedShape.GetPortPosition i, XPos, YPos

      strInfo = strInfo + Chr(10) + Chr(13) + "Port No. " + CStr(i) + " position: (" + CStr(XPos) + ", " + CStr(YPos) + ")"

   Next i

   MsgBox strInfo

   Set pd_SelectedShape = Nothing

End Sub


Defining Range of Shapes (Example)

You can define the range of shapes using the Range method of the Shapes collection. This can be done in four ways. Samples bellow show all four ways the shapes in a range can be assigned a blue color.

1

Defining the range of shapes by specifying shapes by their Names (Range method receives Array of strings)

Dim pd_range As POLARDRAW20Lib.ShapeRange

Dim arr As Variant

arr = Array("Shape2", "Shape3")

Set pd_range = POLARDraw1.ActivePage.Shapes.Range(arr)

With pd_range

.IsFilled = True

.Fill.Type = polSolid

.Fill.Color = vbBlue

End With

Set pd_range = Nothing

2

Defining the range of shapes by specifying shapes by their position in z order (Range method receives Array of numbers)

Dim pd_range As POLARDRAW20Lib.ShapeRange

Dim arr As Variant

arr = Array(1, 2, 3)

Set pd_range = POLARDraw1.ActivePage.Shapes.Range(arr)

With pd_range

   .IsFilled = True

   .Fill.Type = polSolid

   .Fill.Color = vbBlue

End With

Set pd_range = Nothing

3

Defining the shape range with just one shape specified by its Name (Range method receives just one string)

Dim pd_range As POLARDRAW20Lib.ShapeRange

Dim a As String

a = "Shape3"

Set pd_range = POLARDraw1.ActivePage.Shapes.Range(a)

With pd_range

   .IsFilled = True

   .Fill.Type = polSolid

   .Fill.Color = vbBlue

End With

Set pd_range = Nothing

4

Defining the shape range with just one shape specified by its position in z order (Range method receives just one number)

Dim pd_range As POLARDRAW20Lib.ShapeRange

Dim a As Long

a = 3

Set pd_range = POLARDraw1.ActivePage.Shapes.Range(a)

With pd_range

   .IsFilled = True

   .Fill.Type = polSolid

   .Fill.Color = vbBlue

End With

Set pd_range = Nothing


Arrows (Object)

See Also	Properties

An Arrow object represents arrows that are applied either to beginning or the end of the line, polyline (freeform or scribble) or the curve which represent the open path.

Remarks

You can use this object when you want to retrieve or set arrow style to the shape or range of shapes. You can change properties of this object in order to change arrow width, length or head type, either for the start or end of the line.

Arrow object of the autoshapes or any other shape that arrows cannot be applied to, will be NULL.

Warning:

In case you are retrieving values of this object properties from the ShapeRange object, returned values will be those belonging to the shape with the lowest position in the Z-order.

Example

When you want to change starting arrow type of all selected shapes:

Dim objArrow As POLARDRAW20Lib.Arrows

Set objArrow = PolarDraw.ActivePage.Selection.ShapeRange.Arrows

objArrow.StartType = polSimpleArrow


StartType (Property)

See Also	Applies To	Example

Sets and returns start arrowhead style of the line or the range of lines. Line has to be an open path .

Syntax

 StartType [ = number] As polArrowType

StartType syntax has these parts:

Part	Description

number	Constant that determines current arrowhead style as described in Settings.

Settings

The settings for ArrowHead are:

polArrowType	Description

polNothing = 0	No arrow

polSimpleArrow = 1	Simple

polStealthArrow = 2	Stealth

polDiamondArrow = 3	Diamond

polOvalArrow = 4	Oval

polOpenArrow = 5	Open

Remarks

Polar Draw provides an assortment of arrowheads that you can apply to the open path. Properties for setting those arrowheads to the end and to the start of the line are independent. You can choose to apply arrowhead to all open paths in selection (If you are setting the arrow object properties of the selection’s shape range) or to the specific shape (If you are setting the arrow object properties of the single shape object).

When you apply an arrowhead to a path, its size is determined by the thickness of the path's outline. If you increase the thickness, the arrowhead size increases proportionately. To get a larger arrowhead without changing the outline of the path, use the properties for setting the arrow length or arrow width.


EndType (Property)

See Also	Applies To	Example

Sets and returns end arrowhead style of the line or the range of lines. Line has to be an open path .

Syntax

 EndType [ = number] As polArrowType

EndType syntax has these parts:

Part	Description

number	Constant that determines current arrowhead style as described in Settings.

Settings

The settings for ArrowHead are:

polArrowType	Description

polNothing = 0	No arrow

polSimpleArrow = 1	Simple

polStealthArrow = 2	Stealth

polDiamondArrow = 3	Diamond

polOvalArrow = 4	Oval

polOpenArrow = 5	Open

Remarks

Polar Draw provides an assortment of arrowheads that you can apply to the open path. Properties for setting those arrowheads to the end and to the start of the line are independent. You can choose to apply arrowhead to all open paths in selection (If you are setting the arrow object properties of the selection’s shape range) or to the specific shape (If you are setting the arrow object properties of the single shape object).

When you apply an arrowhead to a path, its size is determined by the thickness of the path's outline. If you increase the thickness, the arrowhead size increases proportionately. To get a larger arrowhead without changing the outline of the path, use the properties for setting the arrow length or arrow width.


StartLength (Property)

See Also	Applies To	Example

Sets and returns the length of the arrowhead applied to the start of the line or the range of lines. Line has to be an open path .

Syntax

 StartLength [ = number] As polArrowLength

StartLength syntax has these parts:

Part	Description

number	Constant that determines current arrowhead length as described in Settings.

Settings

The settings for ArrowLength are:

polArrowLength	Description

polShortArrow = 0	Sets the short arrowhead

polMediumArrowL = 1	Sets the medium arrowhead

polLongArrow = 2	Sets the long arrowhead

Remarks

When you apply an arrowhead to a path, its size is determined by the thickness of the path's outline. If you increase the thickness, the arrowhead size increases proportionately. To get a larger arrowhead without changing the outline of the path, use this property (for length setting) or StartWidth property (for width setting).

Properties for setting the arrowhead length to the end and to the start of the line are independent. You can also choose to set arrowhead length to all open paths in selection or to the specific line.


EndLength (Property)

See Also	Applies To	Example

Sets and returns the length of the arrowhead applied to the end of the line or the range of lines. Line has to be an open path .

Syntax

 EndLength [ = number] As polArrowLength

EndLength syntax has these parts:

Part	Description

number	Constant that determines current arrowhead length as described in Settings.

Settings

The settings for ArrowLength are:

polArrowLength	Description

polShortArrow = 0	Sets the short arrowhead

polMediumArrowL = 1	Sets the medium arrowhead

polLongArrow = 2	Sets the long arrowhead

Remarks

When you apply an arrowhead to a path, its size is determined by the thickness of the path's outline. If you increase the thickness, the arrowhead size increases proportionately. To get a larger arrowhead without changing the outline of the path, use this property (for length setting) or EndWidth property (for width setting).

Properties for setting the arrowhead length to the end and to the start of the line are independent. You can also choose to set arrowhead length to all open paths in selection or to the specific line.

Use this property to set the length of the arrowheads applied to the line ends. Line has to be an open path.


StartWidth (Property)

See Also	Applies To	Example

Sets and returns the width of the arrowhead applied to the beginning of the line or the range of lines. Line has to be an open path .

Syntax

 StartWidth [ = number] As polArrowWidth

StartWidth syntax has these parts:

Part	Description

number	Constant that determines current arrowhead width as described in Settings.

Settings

The settings for ArrowWidth are:

polArrowWidth	Description

polNarrowArrow = 0	Sets the narrow arrowhead.

polMediumArrowW = 1	Sets the medium arrowhead.

polWideArrow = 2	Sets the wide arrowhead.

Remarks

When you apply an arrowhead to a path, its size is determined by the thickness of the path's outline. If you increase the thickness, the arrowhead size increases proportionately. To get a larger arrowhead without changing the outline of the path, use this property (for width setting) or StartLength property (for length setting).

Properties for setting the arrowhead width at the end and at the start of the line are independent. You can also choose to set arrowhead width to all open paths in selection or to the specific line.


EndWidth (Property)

See Also	Applies To	Example

Sets and returns the width of the arrowhead applied to the end of the line or the range of lines. Line has to be an open path .

Syntax

 EndWidth [ = number] As polArrowWidth

EndWidth syntax has these parts:

Part	Description

number	Constant that determines current arrowhead width as described in Settings.

Settings

The settings for ArrowWidth are:

polArrowWidth	Description

polNarrowArrow = 0	Sets the narrow arrowhead.

polMediumArrowW = 1	Sets the medium arrowhead.

polWideArrow = 2	Sets the wide arrowhead.

Remarks

When you apply an arrowhead to a path, its size is determined by the thickness of the path's outline. If you increase the thickness, the arrowhead size increases proportionately. To get a larger arrowhead without changing the outline of the path, use this property (for width setting) or EndLength property (for length setting).

Properties for setting the arrowhead width at the end and at the start of the line are independent. You can also choose to set arrowhead width to all open paths in selection or to the specific line.


Lens (Object)

See Also	Properties

The Lens object represents the lens effect applied to a shape.

Remarks

You can use this object when you want to retreive or set the lens type to the shape or range of shapes. You can change the properties of this object in order to change the type of lens effect, effect intensity, or colors used.

To disable the lens effect, set to 'False' the HasLens property of the object that the lens was applied to.

Warning:

In case you are retrieving the values of this objects properties from the ShapeRange object, the returned values will be those belonging to the shape with the lowest position in the Z-order.

Example

When you want to change the type of lens of all selected shapes:

Dim objLens As PolarDraw20Lib.Lens

Set objLens = PolarDraw.ActivePage.Selection.ShapeRange.Lens

objLens.Type = polTransparency


Percent (Property)

See Also	Applies To	Example

Sets and returns the lens' effect intensity expressed in percentage.

Syntax

Percent [ = number] As Long

Percent syntax consists of the following parts:

Part	Description

number	Numeric expression representing the effect intensity expressed in percentage. (Value between -100 and 100 for the righten effect, while in other cases between 0 and 100)

Remarks

Percent property needes to be set if the Lens Type is set to polBrighten, polTransparency, polColorAdd and polColorLimit.


Type (Property)

See Also	Applies To	Example

Sets and returns the lens type.

Syntax

Type [ = number] As polLensType

Type syntax consists of the following parts:

Part	Description

number	Constant that determines the current lens type as described in Settings.

Settings

The settings for LensType are:

polLensType	Description

polBrighten = 0	A Brighten lens adds brightness or darkness to the objects underneath it. The percentage value controls the amount of brightness or darkness created by the lens. The range of 0 to 100% increases the level of brightness, while the range of 0 to -100% increases the level of darkness. You will find the Brighten lens particularly effective for applying the brightness or darkness to a bitmap image.

polColorAdd = 1	When you create a Color Add lens, the colors of the objects beneath the lens are added to the color of the lens as if you were mixing colors of light. The Percent value controls the extent of color addition. A rate of 0% results in no color addition and the lens appears to have no fill. A rate of 100% defines the maximum color addition. Because white light contains all the colors of the spectrum, creating a colored lens and placing it over a white object or a white page turns the lens white. Adding a color to the white light produces white light. To see the effects, the background or object beneath the lens can not be white.

polColorLimit = 2	A Color Limit lens works much like a color filter lens on a camera, allowing only black and the lens' color itself to show through. White and light colors in objects beneath the lens are converted to the lens color. For example, if you place a green Color Limit lens over a bitmap, all colors except green and black are filtered out within the lens area. (Parameters: Percent [0,100], Color)

polCustomPalette = 3	The Custom Color Map lens sets all underlying colors to a color range between any two colors you select. In addition to defining the range's start and end colors, you choose the route or progression between the colors.

polInvert = 6	An Invert lens causes all colors underneath it to appear as their complementary CMYK color. Complementary colors are colors that appear opposite one another on the color wheel. For example, when an Invert lens is applied to a photo bitmap, the result simulates a photographic negative.

polTintedGrayscale = 8	TintedGrayscale: The Tinted Grayscale lens changes the colors of objects underneath it to their grayscale equivalents. The lens color becomes the darkest color in any object under it. All other colors in the object become lighter shades of the lens' color. You will find Tinted Grayscale lenses particularly effective for creating sepia-tone effects. For example, if you place a brown grayscale lens over a color photograph, the photograph takes on a sepia-tone look. You can also turn a color photograph into a black-and-white photograph by placing a black grayscale lens over it. (Parameter: Color)

polHeatmapPalette = 5	The Heat Map lens creates the effect of an infrared image. This lens uses a limited Color Palette of white, yellow, orange, red, blue, violet, and cyan to illustrate the "heat" levels of colors in objects underneath it. Hot colors beneath the lens appear as red or orange, while cool colors appear violet or cyan.

polTransparency = 9	Transparency: the shape takes on the appearance of a piece of tinted plastic film or glass. A transparent lens can be any color. When you place the lens over other objects, these objects take on the lens tint. The Rate setting controls the lens's level of transparency. Rates closer to 100% are more transparent while those closer to 0% are more opaque.


Shape (Object), ShapeRange (Collection Object), Shadow (Object)


Shadow (Object)

See Also	Properties

The Shadow object describes the shape’s shadow.

Remarks

You can use this object when you want to retreive or set the shadow type of the shape or range of shapes. You can change the properties of this object in order to change the shadow type and color, horizontal and vertical offsets of even lens effects applied to a shadow.

Changing the properties of this object will not make the shadow visible. To show or hide the shadow of the object this shadow is applied to, you must set that object’s HasShadow  property to 'True.

Warning:

In case you are retrieving the values of this objects properties from the ShapeRange object, the  returned values will be those belonging to the shape with the lowest position in the Z-order.

Example

When you want to change the type of shadow  for all the selected shapes:

Dim objShadow As PolarDraw20Lib.Shadow

Set objShadow = PolarDraw.ActivePage.Selection.ShapeRange.Shadow

PolarDraw.ActivePage.Selection.ShapeRange.HasShadow = True

objShadow.Type = polDoubleOffShadow


OffsetX (Property)

See Also	Applies To	Example

Sets and returns the amount of horizontal shadow offset.

Syntax

 OffsetX [ = number] As Long

The OffsetX syntax consists of the following parts:

Part	Description

number	A numeric expression representing the amount of shadow offset expressed in MeasurementUnits.


OffsetY (Property)

See Also	Applies To	Example

Sets and returns the amount of vertical shadow offset.

Syntax

OffsetY [ = number] As Long

The OffsetY syntax consist of the folloing parts:

Part	Description

number	A numeric expression representing the amount of shadow offset expressed in MeasurementUnits.


Type (Property)

See Also	Applies To	Example

Sets and returns the shadow type.

Syntax

 Type [ = number] As polShadowType

The Type syntax consists of the following parts:

Part	Description

lShadowType	Constant that determines the current shadow type as described in Settings.

Settings

The settings for ShadowType are:

polShadowType	Description

polOffShadow = 0	Single offset shadow

polDoubleOffShadow = 1	Double offset shadow

polEmboss = 5	Emboss shadow


Line (Object)

See Also	Properties

The Line object represents the characteristics of the shape’s outline.

Remarks

You can use this object when you want to retreive or set the outline style to the shape or range of shapes. You can change the properties of this object in order to change the outline width, color or dashing style.

Changing the properties of the Line object will not make the line visible unless the HasLine property of the shape/shaperange is set to 'True'.

Warning:

In case you are retrieving values of this objects properties from the ShapeRange object, the returned values will be those belonging to the shape with the lowest position in the Z-order.

Example

When you want to change the starting arrow type of all the selected shapes:

Dim objLine As PolarDraw20Lib.Line

Set objLine = PolarDraw.ActivePage.Selection.ShapeRange.Line

objLine.Dashing = polShort_Dash


Dashing (Property)

See Also	Applies To	Example

Sets and returns the shape’s outline dashing type.

Syntax

Dashing [ = number] As polLineDash

The Dashing syntax consists of the following parts:

Part	Description

number	Constant that determines the current line style as described in Settings.

Settings

The settings for LineDashing are:

polLineDash	Description

polSolid = 0	Solid line

polDot = 2	Dotted line

polShort_Dash = 6	Dashed line with short dashes

polShort_Dash_Dot = 7	Short dash - dot

polLong_Dash = 8	Dashed line with long dashes

polLong_Dash_Dot = 9	Long dash - dot

polDash_Dot_Dot = 10	Dash-dot-dot


Width (Property)

See Also	Applies To	Example

Sets and returns the shape’s outline width.

Syntax

Width [ = number] As Long

The Width syntax consists of the following parts:

Part	Description

number	A numeric expression representing the outline width expressed in MeasurementUnits.


Fill (Object)

See Also	Properties	Methods

Fill object represents the object’s fill style and properties.

Remarks

You can use this object when you want to retrieve or set the fill style to the shape or range of shapes. You can change the properties of this object in order to change the fill type, colors and pictures used for that fill type.

Warning:

In case you are retrieving values of this object's properties from the ShapeRange object, the  returned values will be those belonging to the shape with the lowest position in the Z-order.

Example

When you want to change the fill type of all selected shapes:

Dim objFill As PolarDraw20Lib.Fill

Set objFill = PolarDraw.ActivePage.Selection.ShapeRange.Fill

objFill.Type = polSolid


GradientAngle (Property)

See Also	Applies To	Example

Sets or gets the shading angle of the object.

Syntax

GradientAngle [ = angle] As Long

GradientAngle property syntax consists of the following parts:

Part	Description

angle	Numeric expression representing the angle expressed in degrees.

Remarks

This property will be visible for shapes that are filled with polShade Type. Along with the angle, you must also specify the colors that will be used for shading: the color palette is defined with Color and BackColor properties as start and end colors .


Pattern (Property)

See Also	Applies To	Example

Sets or returns the object’s fill pattern.

Syntax

Pattern [ = snPattern] As polPatterns

Pattern property syntax consists of the following parts:

Part	Description

snPattern	Constant that determines the pattern as described in Settings.

Settings

The settings for Pattern are:

polPatterns	Description

pol5Percent = 1	5%

pol50Percent = 2	50%

polLightDownwardDiagonal = 3	 Light downward diagonal

polLightVertical = 4	 Light vertical

polDashedDownwardDiagonal = 5	Dashed downward diagonal

polZigZag = 6	ZigZag

polDivot = 7	 Divot

polSmallGrid = 8	 Small grid

pol10Percent = 9	 10%

pol60Percent = 10	60%

polLightUpwardDiagonal = 11	Light upward diagonal

polLightHorizontal = 12	Light horizontal

polDashedUpwardDiagonal = 13	 Dashed upward diagonal

polWave = 14	 Wave

polDottedGrid = 15	 Dotted grid

polLargeGrid = 16	Large grid

pol20Percent = 17	20%

pol70Percent = 18	70%

polDarkDownwardDiagonal = 19	 Dark downward diagonal

polNarrowVertical = 20	 Narrow vertical

polDashedHorizontal = 21	 Dashed horizontal

polDiagonalBrick = 22	Diagonal brick

polDottedDiamond = 23	Dotted diamond

polSmallCheckerBoard = 24	 Small checker board

pol25Percent = 25	25%

pol75Percent = 26	75%

polDarkUpwardDiagonal = 27	 Dark upward diagonal

polNarrowHorizontal = 28	 Narrow horizontal

polDashedVertical = 29	 Dashed vertical

polHorizontalBrick = 30	Horizontal brick

polShingle = 31	Shingle

polLargeCheckerBoard = 32	Large checker board

pol30Percent = 33	30%

pol80Percent = 34	80%

polWideDownwardDiagonal = 35	 Wide downward diagonal

polDarkVertical = 36	 Dark vertical

polSmallConfetti = 37	Small confetti

polWeave = 38	Weave

polTrellis = 39	Trellis

polOutlinedDiamond = 40	Outlined diamond

pol40Percent = 41	40%

pol90Percent = 42	90%

polWideUpwardDiagonal = 43	 Wide upward diagonal

polDarkHorizontal = 44	 Dark horizontal

polLargeConfetti = 45	Large confetti

polPlaid = 46	Plaid

polSphere = 47	 Sphere

polSolidDiamond = 48	 Solid diamond

Remarks

Polar Draw provides an assortment of 48 patterns that you can apply to shapes. This property takes effect when the Type property is set to polPattern. All offered patterns are two-color patterns. Colors that will be used as foreground color and background color are defined with the Color and BackColor properties.


RotateGradient (Property)

See Also	Applies To	Example

Sets and returns the flag that indicates whether shading fill of the object that it is applied to will be rotated with the object.

Syntax

RotateGradient [ = bNewValue] As Boolean

RotateGradient property syntax consists of the following parts:

Part	Description

bNewValue	A Boolean expression indicating whether shading fill will be rotated during the shape rotation.

Remarks

This property will be visible only for shapes that are filled with the polShade Type. If it is set to 'True', the shading angle will be increased with the rotation angle. If it is set to 'False', the rotation will not affect the shading angle.


Texture (Property)

See Also	Applies To	Example

Sets or returns the object’s fill texture.

Syntax

Texture [ = nTexture] As polTextures

Texture property syntax consists of the following parts:

Part	Description

nTexture	Constant that determines the texture as described in Settings.

Settings

The settings for Texture are:

nTexture	Description

polDrops = 1	Water Drops

polPaperbag = 2	Paperbag texture

polWood = 3	Wood surface

polFishFossil = 4	Fish fossil

polNewsprint = 5	Newsprint

polRecycledPaper = 6	Recycled paper

polParchment = 7	Parchment

polStationery = 8	Stationery

polGreenMarble = 9	Green marble

polWhiteMarble = 10	White marble

polBrownMarble = 11	Brown marble

polGranite = 12	Granite

polBlueTissuePaper = 13	Blue tissue paper

polPinkTissuePaper = 14	Pink tissue paper

polPurpleMesh = 15	Purple mesh

polBouquet = 16	Bouquet

polPapyrus = 17	Papyrus

polCanvas = 18	Canvas

polDenim = 19	Denim

polWovenMat = 20	Woven mat

polSand = 21	Sand

polCork = 22	Cork

polWalnut = 23	Walnut

polOak = 24	Oak

Remarks

Polar Draw provides an assortment of 24 textures that you can apply to shapes. If you want to fill the shape with your own texture, see one of the SetTexture methods.

This property takes effect when the Type property is set to polTexture.


SetPictureFromFile (Method)

See Also	Applies To	Example

Use this method to set the picture that will fill in the shape or range of shapes.

Syntax

Sub SetPictureFromFile(szFileName As String)

SetPictureFromFile method syntax consists of the following parts:

Part	Description

szFileName	A string expression defining the path and filename of the picture.

Remarks

This method loads a bitmap file into a shape. If you need to load other pictures, see the SetPictureFromObject method. A loaded bitmap will stretch from margin to margin of the shape’s bounding box, without keeping its original proportions. When the shape that is filled with the picture is rotating, the picture will not be rotated together with the shape. It will remain in its start position and will be stretched between the bounding box margins.

This method takes effect when the Type property is set to polPicture.


SetPictureFromObject (Method)

See Also	Applies To	Example

Use this method to set the picture that will fill in the shape or range of shapes.

Syntax

Function SetPictureFromObject(Picture As StdPicture) As Boolean

SetPictureFromObject method syntax consists of the following parts:

Part	Description

Picture	The Picture object enables you to manipulate bitmaps, icons, metafiles, enhanced metafiles, GIF, and JPEG images assigned to objects having a Picture property.

Remarks

This method takes effect when the Type property is set to polPicture. It is similar to the SetPictureFromFile method, but the difference is in the type of pictures that can be loaded.

A loaded bitmap will stretch from margin to margin of the shape’s bounding box, without keeping its original proportions. When the shape that is filled with the picture is rotating, the picture will not be rotated together with the shape. It will remain in its start position and will be stretched between the bounding box margins.


SetTextureFromFile (Method)

See Also	Applies To	Example

Use this method to set the texture for filling in.

Syntax

Sub SetTextureFromFile(szFileName As String)

SetTextureFromFile method syntax consists of the following parts:

Part	Description

szFileName	A string expression defining the path and filename of the texture.

Remarks

This method loads a bitmap file into a shape. If you need to load other pictures, see the  SetTextureFromObject method. The loaded bitmap will remain in its original size. If the picture is smaller than the shape, it will tile the shape.

This method takes effect when the Type property is set to polTexture.


SetTextureFromObject (Method)

See Also	Applies To	Example

Use this method to set the texture for filling in.

Syntax

Function SetTextureFromObject(Picture As StdPicture) As Boolean

SetTextureFromObject method syntax consists of the following parts:

Part	Description

Picture	The Picture object enables you to manipulate bitmaps, icons, metafiles, enhanced metafiles, GIF, and JPEG images assigned to objects having a Picture property.

Remarks

This method takes effect when the Type property is set to polTexture. It is similar to the SetTextureFromFile, but the difference is in type of pictures that can be loaded.

The loaded picture will remain in its original size. If the picture is smaller than the shape, it will tile the shape.


Type (Property)

See Also	Applies To	Example

Sets and returns the fill type.

Syntax

Type [ = number] As polLensType

Type syntax consists of the following parts:

Part	Description

number	Constant that determines current filling style as described in Settings.

Settings

The settings for FillType are:

polFillType	Description

polSolidColor = 0	The shape will be filled with the solid color. The color can be set with the Color property.

polPattern = 1	The shape will be filled with the predefined pattern. The pattern can be defined with the Pattern property, or with the PatternDlg method which will invoke a dialog-box with pattern samples.

polTexture = 2	the shape can be filled with the predefined texture or one of the graphical files from your disk. More…

polPicture = 3	The shape will be filled with one of the graphical files from your disk. More…

polShade = 7	the shape will be shaded with the color palette defined with Color and BackColor as start and end colors and the GradientAngle. See also GradientDlg.


Text (Object)

See Also	Properties	Methods

The Text object describes the text displayed in the shape.

Remarks

This object can be retrieved from the Shape or the ShapeRange object, using the Text. Property.  However, it has a different behavior for polPlainText shapes and all other autoshapes.

You can use it to set the text that will be displayed inside the bounding box of the autoshape (it can be RTF formatted text, or simple plain text) or the content of the plain text shape. You can also use it to retrieve the Font object so as  to set the font of the Plain text shape.


Plain (Property)

See Also	Applies To	Example

Sets/Gets the string displayed in the plain text shape, or in the autoshape.

Syntax

Plain [= strText] As String

Plain property syntax consists of the following parts:

Part	Description

strText	A string expression representing text that will be displayed.

Remarks

Use this property when you want to change the text content manually. If you want to enable users to do that, use the Edit method.

If the plain text is in question, you can use just this property to change the text. For any other autoshape, you can also use the RTFText property.

This text will be formatted as it is set in the Font object, but remember, you must first set the font attributes and then the plain text property!

Note

Default formatting of this text cannot be changed, but you can catch the BeforeShapeAdded event and set the properties of the Font object there. The Text will appear in the format you set.

Do not forget to turn off the rendering, otherwise all the steps of changing the font will be visible to the user. See Example.


RTFText (Property)

See Also	Applies To	Example

Sets/Gets the string that represents the RTF formatted text displayed in the autoshape.

Syntax

RTFText [= strText] As String

RTFText property syntax consists of the following parts:

Part	Description

strText	A string expression representing text that will be displayed.

Remarks

Use this property when you want to change the text content and formatting manually. If you want to enable users to do that, use the Edit method.

If the plain text is in question, you can not use this property. You can only change the font in the Plain text formatting. Changing this property value will not affect the Plain text shapes.

For any other autoshape, you can set the pre-formatted text (RTF) using this property, or just the plain text using the Plain property.


Font (Property)

See Also	Applies To	Example

Returns a Font object that represents the character formatting of the specified object.

Syntax

Font As Font


Edit (Method)

See Also	Applies To	Example

Displays dialog box for editing text.

Syntax

Function Edit() As Boolean

Returned value

True 	if the user has edited the text and clicked the OK button in the editor.

False	if the user has edited the text in the editor, and clicked the Cancel button in the editor.

Remarks

Use this method when you want to allow the user to change the text in a text box shape.


Lock (Object)

See Also	Properties

The Lock object represents the lock properties of the object that it is applied to.

Remarks

You can use this object when you want to retrieve or set limitations of the object’s performance. You can change the properties of this object in order to lock hape against rotation or selection.

Warning:

In case you are retrieving the values of this object properties from the ShapeRange object, returned values will be those belonging to the shape with the lowest position in the Z-order.


AgainstSelection (Property)

See Also	Applies To	Example

Sets and returns the flag that specifies whether the object is locked for selection.

Syntax

AgainstSelection[ = bNewValue] As Boolean

AgainstSelection property syntax consists of the following psrts:

Part	Description

bNewValue	A Boolean expression that determines whether the object  can be selected or not:

Remarks

If this property is set to 'True', the specified shape cannot be selected, but this applies only when the end-user tries to select the shape.

This means that the end-user will not be able to select that shape by clicking it. If the specific shape is already selected while invoking this method, the selection handles (little white rectangles) will not be erased until something else is selected, or until  you call the Render method.

Note

Selecting shapes using the  AddToSelection, or SelectAll methods will be successful no matter what the value of this property is.


AgainstRotation (Property)

See Also	Applies To	Example

Sets and returns the flag that specifies whether the object is locked for rotation.

Syntax

AgainstRotation[ = bNewValue] As Boolean

AgainstRotation property consists of the following:

Part	Description

bNewValue	A Boolean expression that determines whether the object can be rotated or not:

Remarks

If this property is set to 'True', a specified shape will be locked for rotation. This means that the end-user will not be able to rotate that shape by clicking it and dragging the selection handles.

This method is very useful for text box shapes when you want to disable the rotation which could hide the part of the displayed text in the text box.

Note

Shapes can be rotated programatically (using the Rotate, or RotateAroundPoint, methods, or the Rotation property) no matter if the specified shape is locked against rotation, or not.


Connection (Object)

See Also	Properties	Methods

The connection object represents the properties of the link between two other shapes. This object is created only if its parent is a shape that connects two other shapes.

Remarks

You can use this object when you want to read or set preferences that describe a connection between shapes. It informs you about which of the two shapes are connected, which are the connection ports and even helps you to change the source, the destination shapes or the ports.

Warning:

Not all shapes have Connection object preferences. You must first determine wether the shape is a link (IsLink property) and then create the Connection object.

To retrieve all the links from one shape, you must isolate that shape, and then use the Connections property to reveal all its links to other shapes.


Destination (Property)

See Also	Applies To	Example

Returns the shape that represents the destination of this connection.

Syntax

Destination As Shape

Remarks

This property is read-only. To change the destination, you must use the DestinationConnect method.


Source (Property)

See Also	Applies To	Example

Returns the shape that represents the source of this connection.

Syntax

Source As Shape

Remarks

This property is read-only. To change the source, you must use the SourceConnect method.


DestinationPort (Property)

See Also	Applies To	Example

Returns the part of a shape to which a connection is made.

Syntax

DestinationPort As Long

Remarks

Each shape has a set of points that can be ports. A port is a point on the shape which can ‘catch’ the connection. If you turn on the ShowConnectors property value, the ports will be visible as little blue crosses.

If CurrentShapeType is set to polLink value, the end-users will see one little blue rectangle as they move the mouse pointer closer to any shape. That rectangle represents the nearest port that will be connected to the link if he starts (or ends) with a connection creation.

Those ports are enumerated and this property returns the ordinal number of the port. The center of the shape is the port with the index value 1’.

This property is read-only. To change the destination port you must use the DestinationConnectmethod.


SourcePort (Property)

See Also	Applies To	Example

Returns the part of a shape from which a connection originates.

Syntax

SourcePort As Long

Remarks

Each shape has a set of points that can be ports. The port is a point on the shape which can ‘catch’ the connection. If you turn on the ShowConnectors property value, the ports will be visible as little blue crosses.

If CurrentShapeType is set to polLink value, the end-users will see one little blue rectangle as they move mouse pointer closer to any shape. That rectangle represents the nearest port that will be connected to the link if he starts (or ends) with the connection creation.

Those ports are enumerated and this property returns the ordinal number of the destination port. The center of the shape is the port with the index value 1.

This property is read-only. To change the source port, you must use SourceConnectmethod.


Routing (Property)

See Also	Applies To	Example

Returns the type of connection

Syntax

Routing As polLinkType

Settings

polLinkType	Description

polDirectLink = 0	A Direct connection. It connects the source port directly with the destination port.

polManhattanLink = 1	A Rectangular connection. It has only vertical and horizontal segments.

Remarks

Use this property to define what type of connection will be used. When you create a new connection using the AddConnection method, a Manhattan link is created by default. (Same goes for end-users when they are creating polLink shapes.)

Note

This property value is considered only before adding or re-connecting links. This means that if you create one connection and then change the value of this property to polDirectLink, the link will not change visually. Only after you apply the SourceConnect or the DestinationConnect properties will the new connection type be visible.


SourceConnect (Method)

See Also	Applies To	Example

Use this method when you want to change the point that the connection originates from, whether you want to change just the port, or  the source shape as well.

Syntax

Function SourceConnect(lShapeID As Long, lPortID As Long) As Boolean

SourceConnect method syntax has these parts:

Part	Description

lShapeID	A numeric expression that uniquely identifies a shape.

lPortID	A numeric expression that uniquely identifies the port.

Returned value

The Returned value is a Boolean expression that informs you whether this method has succeeded. The Returned value will be 'False' if method did not succeed.

Possible errors:

•	A shape with the specified ID does not exist

•	A port with the specified ID does not exist on the specified shape

Remarks

Use this method when you want to re-connect an existing connection. You can also apply this method after you change the Routing type.


DestinationConnect (Method)

See Also	Applies To	Example

Use this method when you want to change the point to which a connection is made, whether you want to change just the port, or the destination shape as well.

Syntax

Function DestinationConnect(lShapeID As Long, lPortID As Long) As Boolean

DestinationConnect method syntax has these parts:

Part	Description

lShapeID	A numeric expression that uniquely identifies a shape.

lPortID	A numeric expression that uniquely identifies the port.

Returned value

The Returned value is a Boolean expression that informs you whether this method succeeded. The Returned value will be 'False' if the method did not succeed.

Possible errors:

•	 A shape with the specified ID does not exist

•	 A port with the specified ID does not exist on the specified shape

Remarks

Use this method when you want to re-connect an existing connection. You can also apply this method after you change the Routing type.


Vertex (Object)

See Also	Properties	Methods

The Vertex object represents one node of the shapes that are represented as polyline.

Remarks

This object can be retrieved from the Vertices collection using the Item method and by specifying the index of the node (the ordinal number of node is determined by its position from the polygon start point).

Be careful when specifying the node because when you create the Vertex object as Vertices.Item(3), the Vertex will represent the third node, but when you delete that node, the same object will still refer to the ‘third’ node which took place after the previous third was deleted. The Vertex will than represent the previous fourth node.

Use this object when you want to set the new coordinates of the specific node; just move or delete it.


x (Property)

See Also	Applies To	Example

Sets and gets the x coordinate of the vertex.

Syntax

x [ = lX] As Long

x property syntax consists of the following parts:

Part	Description

lX	the Numeric expression representing the x coordinate. The value must be in the range between 0 and 65535 (See Remarks).

Remarks

The polygon nodes are relative to the bounding box. The coordinates are plotted within the bounding box of the polygon. The bounding box is divided into 65536 units and is scaled from 0 to 65535 for both the x and y dimensions. This means, if we want to place one of the polygon nodes to the left-top corner of the bounding box, it will have coordinates (0, 0), in the middle it will be (65535/2, 65535/2) = (32768,32768), and in the right-bottom corner, the coordinates must be (65535,65535).


y (Property)

See Also	Applies To	Example

Sets and gets the y coordinate of the vertex.

Syntax

y [ = lY] As Long

y property syntax consists of the following parts:

Part	Description

lY	The numeric expression representing the y coordinate. The value must be in the range between 0 and 65535 (See Remarks).

Remarks

The Polygon nodes are relative to the bounding box. The coordinates are plotted within the bounding box of the polygon. The bounding box is divided into 65536 units and scaled from 0 to 65535 for both the x and y dimensions. This means, if we want to place one of the polygon nodes to the left-top corner of the bounding box, it will have the coordinates (0, 0), in the middle it will be (65535/2, 65535/2) = (32768,32768), and in the right-bottom corner, coordinates must be (65535,65535).


Index (Property)

See Also	Applies To	Example

Returns the Index of the vertex.

Syntax

Index [ = lIndex] As Long

Index property syntax consists of the following parts:

Part	Description

lIndex	Numeric expression representing the ordinal number of the vertex.

Remarks

When you create the Vertex object as Vertices.Item(3), the Vertex will represent the third node, but when you delete that node, the same object will still refer to the ‘third’ node which took place after the previous third was deleted. The vertex will than represent the previous fourth node. This property is used to get information about which node is currently represented.


Move (Method)

See Also	Applies To	Example

Use this method when you want to move the vertex respective to its current position.

Syntax

Sub Move(lX As Long, lY As Long)

Move method syntax consists of the following parts:

Part	Description

lX	Numeric expression representing the horizontal offset in relative units. (See Remarks).

lY	Numeric expression representing the vertical offset in relative units. (See Remarks).

Remarks

Polygon nodes are relative to the bounding box. The coordinates are plotted within the bounding box of the polygon. The bounding box is divided into 65536 units and scaled from 0 to 65535 for both the x and y dimensions. This means, if we want to place one of the polygon nodes to the left-top corner of the bounding box, it will have the coordinates (0, 0), in the middle it will be (65535/2, 65535/2) = (32768,32768), and in the right-bottom corner, the coordinates must be (65535,65535).


Vertices (Collection Object)

See Also	Properties	Methods

The vertices collection represents the set of polygon vertexes.

Remarks

This object can only be retrieved using the Vertices property of the Shape object. It will be created only if the source shape is a polygon.

A Polygon is:

•	any shape created when the CurrentShapeType property is set to polFreeform,

•	added with the AddPolygon method,

•	or any other shape after the ConvertToPolygon method is applied.

Use this method when you want to set existing vertexes, add, or insert new ones, or check whether the polygon is closed.


IsClosed (Property)

See Also	Applies To	Example

Sets and returns the flag that determines whether  a specific polygon is closed.

Syntax

IsClosed[ = bNewValue] As Boolean

The IsClosed syntax consists of the following parts:

Part	Description

bNewValue	A Boolean expression indicating whether the shape(s) is a closed polygon.

A Boolean expression that determines whether the polygon is a closed one:

True	Polygon is closed.

False	Polygon is NOT closed, or specific shape is not a polygon at all.

Remarks

A path that completely encloses an area because the path's start and end points are connected is a closed polygon. Use this property to get to know if the specified polygon is closed. It is useful to retrieve this information if you want to limit the fill attributes to only the closed polygons.


Add (Method)

See Also	Applies To	Example

Use this method to add a node to an existing polygon.

Syntax

Sub Add(lX As Long, lY As Long)

Add method syntax consists of the following parts:

Part	Description

lX	A numeric expression that identifies the X-coordinate of the new node.

lY	A numeric expression that identifies the Y-coordinate of the new node.

Remarks

Use this method if you want to add a node to the specified polygon. The coordinates of this new vertex (lX, lY) must be defined relative to the bounding box of the polygon.

Those coordinates are not limited by the size of the bounding box. You can add as many nodes as you want as the  bounding box will resize, keeping the same relation between nodes and the size of bounding rectangle.

This node will be added as the last node of the polygon. If you want to insert a node between two existing ones, use the Insert method.

See Example below


Insert (Method)

See Also	Applies To	Example

Use this method to insert a node into the specified location of an existing polygon.

Syntax

Sub Insert(lRefPt As Long, lX As Long, lY As Long)

The Insert method syntax consists of the following parts:

Part	Description

lRefPt	A number expression that identifies a node. (Ordinal number of the node - polygon nodes counting starts with 1.)

lX	A numeric expression that identifies the X-coordinate of the new node.

lY	A numeric expression that identifies the Y-coordinate of the new node.

Remarks

Use this method if you want to add a node to a the specific location. The coordinates of the node (lX, lY) must be defined relative to the bounding box of the polygon.

This node will be added before the node specified by the lRefPt parameter. If you want to add the last node, use the Add method.


SetPoints (Method)

See Also	Applies To	Example

Use this method to set the position of nodes in an existing polygon.

Syntax

Sub SetPoints(xArray, yArray)

The SetPoints method syntax consists of the following parts:

Part	Description

xArray	An array of VARIANTs, LONGs or INTs for the  X-coordinates of the polygon nodes.

yArray	An array of VARIANTs, LONGs or INTs for the Y-coordinates of the polygon nodes.

Remarks

Use this method if you want to define the location of the nodes in the polygon. The placement of the polygon nodes is defined in the array specified by xArray and yArray.

xArray and yArray are arrays of the polygon's nodes' coordinates, and they must contain the same number of elements.

The polygon's nodes (elements of xArray and yArray) are relative to the bounding box. The coordinates are plotted within the bounding box of the polygon. The bounding box is divided into 65536 units and scaled from 0 to 65535 for both the x and y dimensions. This means, if we want to place one of the polygon nodes at the top-left corner of the bounding box, it will have the coordinates (0, 0), in the middle it will be (65535/2, 65535/2) = (32768,32768), and in the right-bottom corner, the coordinates must be (65535,65535).

To make a closed polygon, first and last nodes must have the same coordinates.


Color (Property)

See Also	Applies To 	Example

Sets or gets the foreground color of an object that it is applied to.

Syntax

Color [ = color] As OLE_COLOR

Color property syntax has these parts:

Part	Description

color	This value can be one of the normal RGB Colors. It represents the value of the foreground color.

Remarks

In the Fill object this property is needed to be set before the fill Type is set to polSolid, polPattern or polShade constants. In the case of a polSolid filling type, Color represents the filling color. In the case of a polShade filling type, Color represents the start color for shading, while in the case of a polPattern filling type it represents the pattern foreground color.

Lens types that need the Color property to be set are polCustomPalette (as the start color), polColorLimit, polColorAdd and polTintedGrayscale.


BackColor (Property)

See Also	Applies To	Example

Sets or gets the background color of an object that it's applied to.

Syntax

BackColor [ = color] As OLE_COLOR

BackColor property syntax has these parts:

Part	Description

color	This value can be one of the normal RGB Colors. It represents the value of the background color.

Remarks

In the Fill object this property is needed to be set before the fill Type is set to polPattern or polShade constants. In the case of a polShade filling type, Color represents the ending color for shading, while in the case of a polPattern filling type it represents the pattern background color.

Background color is also needed in lens effects that need two color parameters: polCustomPalette as end color of the custom palette.


Fill (Property)

See Also	Applies To	Example

Returns a Fill object that refers to the fill formatting of the specific shape or range of shapes. This property is read-only.

Syntax

Fill As Fill


Line (Property)

See Also	Applies To	Example

Returns a Line object that refers to the line formatting of the specific shape or range of shapes. This property is read-only.

Syntax

Line As Line


Arrows (Property)

See Also	Applies To	Example

Returns a Arrows object that refers to the arrows formatting of the specific shape or range of shapes. This property is read-only.

Syntax

Arrows As Arrows


Shadow (Property)

See Also	Applies To	Example

Returns a Shadow object that refers to the shadow formatting of the specific shape or range of shapes. This property is read-only.

Syntax

Shadow As Shadow


Lock (Property)

See Also	Applies To	Example

Returns a Lock object that describes lock properties of the specific shape or range of shapes. This property is read-only.

Syntax

Lock As Lock


Lens (Property)

See Also	Applies To	Example

Returns a Lens object that describes the lens effect that is applied to the object. This property is read-only.

Syntax

Lens As Lens


Connection (Property)

See Also	Applies To

Returns a Connection object that contains all characteristics of the shape that represents a link between two shapes. This property is read-only.

Syntax

Connection As Connection


Hyperlink (Property)

See Also	Applies To

Returns a Hyperlink object. This property is read-only.

Syntax

Hyperlink As Hyperlink


Vertices (Property)

See Also	Applies To

Returns a Vertices object that represents set of vertices in a freeform shape (curve, freeform polygon or the scribble). This property is read-only.

Syntax

Vertices As Vertices


Text (Property)

See Also	Applies To

Returns a Text object that represents the text content and formatting of the specific shape or range of shapes. This property is read-only.

Syntax

Text As Text


Root (Property)

Applies To

Returns the root object of the specified object. As the name implies, a root object is at the base of an object model. Thus it can be thought of as the object that contains all the other objects in the object model. This property is read-only.

Syntax

Root As Object

Remarks

Root object of all Polar Draw objects is PolarDraw object.


Parent (Property)

Applies To

Returns the parent object of the specified object. This property is read-only.

Syntax

Parent As Object

Remarks

In general, an object's parent is the object that contains it. For example, the parent of a Guideline object is the Guidelines collection that contains the Guideline object.

If a Shape object is a member of a group, the parent is that group (ShapeRange or Shapes collection).

Example

This is an example how to follow the number of current horizontal guidelines, without knowing which guidelines are in question. When the user clicks on the button, we are retrieving the collection of guidelines that the specific guideline belongs to, and adding new ones.

Dim pd_guides As POLARDRAW20Lib.Guidelines

Dim pd_line As POLARDRAW20Lib.Guideline

Dim Counter As Long

Private Sub btnAdd_Click()

    Dim NewObj As Object

    Set NewObj = pd_line.Parent

    MsgBox CStr(NewObj.Count)

    NewObj.Add 40 * Counter

    Counter = 1 + Counter

    pd.ActiveWindow.Environment.ShowGuidelines = True

    MsgBox CStr(NewObj.Count)

End Sub

Private Sub Form_Load()

    Set pd_guides = pd.ActivePage.HorGuidelines

    Set pd_line = pd_guides.Add(0)

    Counter = 1

End Sub


ObjType (Property)

Applies To

Returns the constant that specifies the type of the object, as described in the Settings.

Syntax

ObjType As polObjectType

Settings

polObjectType	Description

polArrowsObject	22

polConnectionObject	28

polDrawControlObject 	1

polEnvironmentObject	37

polFillObject	15

polFontObject 	30

polGuidelineObject	17

polGuidelinesObject	16

polHyperlinkObject	35

polLensObject	23

polLineObject	21

polLockObject	29

polPageObject	12

polPagesObject	11

polSelectionObject	18

polShadowObject	24

polShapeObject 	14

polShapeRangeObject	19

polShapesObject	13

polTextObject	25

polVertexObject	33

polVerticesObject	32

polWindowObject	36


Count (Property)

Applies To

Returns the number of items in the specified collection. This property is read-only.

Syntax

Count As Long


Item (Method)

Applies To

Returns a member of a collection, by position. The Item method is the default method for collections.

Syntax

Function Item(lIndex As Long) As Object

The Item method syntax has these parts:

Part	Description

lIndex	The index number of a member of the collection. The index can be a numeric expression (a number from 1 to the value of the collection's Count property).

Remarks

In the Shapes and ShapeRange collections, the Index represents the position of the shape in the z-order. If the value provided as the Index does not match any existing member of the collection, an error occurs.

In the Guidelines collection, the index is the ordinal number of the guideline in the collection. If the Guidelines collection represents the set of horizontal guides, the ordinal number of each guideline can be retrieved counting the guidelines from the top (beginning with one). The ordinals of vertical guides are counted from the left.


ItemFromID (Method)

Applies To

Returns a shape specified by its ID.

Syntax

Function ItemFromID(lID As Long) As Shape

The ItemFromID method syntax has these parts:

Part	Description

lID	Shape ‘s ID

Remarks

In the Shapes and ShapeRange collections, it is possible to retrieve the specific object in two ways ie. with an Item method, specifying shape’s position, or by using the number that uniquely identifies the shape.


Delete (Method)

See Also	Applies To

Use this method if you want to remove the object.

Syntax

Sub Delete()

Remarks

Be careful when using this method with the Vertex object. The Vertex which is retrieved as  Vertices.Item(1) gets the Vertex (which is the first point in that polygon). After you apply the delete method, the same object is not destroyed! It is still the first point of the polygon, while the previous first point is now the second point. For example:

Set pd_vertex = pd_shape.Vertices.Item(1)

MsgBox Cstr(pd_vertex.Index)

Pd_vertex.Delete

MsgBox Cstr(pd_vertex.Index)

Both message boxes will display number 1.

Note

If the polygon contains just two points, you can not delete them using this method because there is no polygon that contains less then two points. You must delete whole shape.


Click (Event)

See Also	Applies To

Occurs when the user presses and then releases a mouse button over the

Polar Draw canvas.

Syntax

Private Sub object_Click()

Remarks

It is important to emphasize that this event occurs only if the viewport has been clicked. Clicking the ruler or the scrollbar will fire new events: RulerClicked and ScrollBarClicked .

Clicking a control generates MouseDown and MouseUp events in addition to the Click event. When you are attaching event procedures for these related events, be sure that their actions do not conflict. If there is code in the MouseDown event, the MouseUp and Click events will never trigger.

To distinguish between the left, right, and middle mouse buttons, use the MouseDown and MouseUp events.

If there is code in the Click event, the DblClick event will never trigger because the Click event is the first event to trigger between the two. As a result, the mouse click is intercepted by the Click event so the DblClick event does not occur.


ControlGotFocus (Event)

See Also	Applies To

This occurs when an object receives the focus either by user action, such as tabbing to or clicking the object, or by changing the focus in code.

Syntax

Private Sub object_ControlGotFocus(hWnd As OLE_HANDLE)

The ControlGotFocus event syntax has the following parts:

Part	Description

hWnd	Returns a handle to a form or control that lost focus

Remarks

In distinction from the GotFocus event, this event returns a handle to a form or control that lost focus.

The Microsoft Windows operating environment identifies each form and control in an application by assigning it a handle, or hWnd. The hWnd property is used with Windows API calls. Many Windows operating environment functions require the hWnd of the active window as an argument.

Note

Because the value of this property can change while a program is running, never store the hWnd value in a variable.


ControlLostFocus (Event)

See Also	Applies To

This occurs when an object loses the focus either by user action, such as tabbing to or clicking another object, or by changing the focus in code.

Syntax

Private Sub object_ControlLostFocus(hWnd As OLE_HANDLE)

The ControlLostFocus event syntax has the following parts:

Part	Description

hWnd	Returns a handle to a form or control that gets focus

Remarks

In distinction from the LostFocus event, this event returns a handle to a form or control that gets focus.

The Microsoft Windows operating environment identifies each form and control in an application by assigning it a handle, or hWnd. The hWnd property is used with Windows API calls. Many Windows operating environment functions require the hWnd of the active window as an argument.

Note

Because the value of this property can change while a program is running, never store the hWnd value in a variable.


DblClick (Event)

See Also	Applies To

This occurs when the user presses and releases a mouse button and then presses and releases it again over an object.

Syntax

Private Sub object_DblClick()

Remarks

If the DblClick does not occur within the system's double-click time limit, the object recognizes another Click event. The double-click time limit may vary because the user can set the double-click speed in the Control Panel. When you are attaching procedures for these related events, be sure that their actions do not conflict. Controls that do not receive DblClick events may receive two clicks instead of a DblClick.

Note

To distinguish between the left, right, and middle mouse buttons, use the MouseDown and MouseUp events.

If there is code in the Click event, the DblClick event will never trigger.


ErrorReadingFile (Event)

See Also	Applies To	Example

This event occurs if the Read method fails.

Syntax

Private Sub object_ErrorReadingFile(szErrorMsg As String, lErrorCode As Long, pbIgnore As Boolean)

The ErrorReadingFile event syntax has these parts:

Part	Description

szErrorMsg	A string expression containing the error description.

lErrorCode	A numeric expression representing the error identification number.

pbIgnore	Indicates whether default error processing will be skipped

Settings

The settings for pbIgnore are:

Part	Description

True	Default error processing will be skipped.

False	Default error processing will not be skipped.

Remarks

You can catch this event if you want to decide whether the program will be terminated with this error or whether it wil lcontinue executing. If you want your application to continue with its execution in spite of the error, set the pbIgnore value to 'True'.

Note

This event will not occur if the property value AllowErrorReporting is set to 'False'.


ErrorWritingFile (Event)

See Also	Applies To	Example

This event occurs if function Write fails.

Syntax

Private Sub object_ErrorWritingFile(szErrorMsg As String, lErrorCode As Long, pbIgnore As Boolean)

The ErrorWritingFile event syntax has these parts:

Part	Description

szErrorMsg	A string expression containing the error description.

lErrorCode	A numeric expression representing the error identification number.

pbIgnore	Indicates whether default error processing will be skipped

Settings

The settings for pbIgnore are:

Part	Description

True	Default error processing will be skipped.

False	Default error processing will not be skipped.

Remarks

You can catch this event if you want to decide whether the program will be terminated with this error whether it will continue executing. If you want your application to continue with its execution in spite of the error, set the pbIgnore value to 'True'.

Note

This event will not occur if the property value AllowErrorReporting is set to 'False'.


GotFocus (Event)

See Also	Applies To

This occurs when an object receives the focus either by user action, such as tabbing to or clicking the object, or by changing the focus in code.

Syntax

Private Sub object_GotFocus()

Remarks

Typically, you use a GotFocus event procedure to specify the actions that occur when a control first receives the focus. For example, by attaching a GotFocus event procedure to each control on a form, you can guide the user by displaying brief instructions or status bar messages.


KeyDown / KeyUp (Event)

Applies To	Example

This occurs when the user presses (KeyDown) or releases (KeyUp) a key while an object has the focus.

Syntax

Private Sub object_KeyDown(KeyCode As Integer, Shift As Integer)

Private Sub object_KeyUp(KeyCode As Integer, Shift As Integer)

KeyDown and KeyUp event syntax has the following parts:

Part	Description

KeyCode	A key code, such as vbKeyF1 (the F1 key) or vbKeyHome (the HOME key).

Shift	An integer that corresponds to the state of the SHIFT, CTRL, and ALT keys at the time of the event. The shift argument is a bit field with the least-significant bits corresponding to the SHIFT key (bit 0), the CTRL key (bit 1), and the ALT key (bit 2 ). These bits correspond to the values 1, 2, and 4, respectively. Some, all, or none of the bits can be set, indicating that some, all, or none of the keys are pressed. For example, if both CTRL and ALT are pressed, the value of shift is 6.

Remarks

For both events, the Polar Draw object receives all keystrokes if it has the focus.

Use KeyDown and KeyUp event procedures if you need to respond to both the pressing and releasing of a key.

KeyDown and KeyUp determine whether each character is in uppercase or lowercase by means of using two arguments: KeyCode, which indicates the physical key (thus returning A and a as the same key) and Shift, which indicates the state of shift+key and therefore returns either A or a.

If you need to test for the shift argument, you can use the shift constants which define the bits within the argument. The constants act as bit masks that you can use to test for any combination of keys.


LostFocus (Event)

See Also	Applies To

Occurs when an object loses the focus either by user action, such as tabbing to or clicking another object, or by changing the focus in the code.

Syntax

Private Sub object_LostFocus()

Remarks

A LostFocus event procedure is primarily useful for verification and validation updates. Using LostFocus can cause validation to take place as the user moves the focus from the PolarDraw control. You can also reverse or change conditions that you set up in the object's GotFocus event procedure.


Modified (Event)

See Also	Applies To

Occurs when a change is made in the drawing. That can be the creation of new a shape, the deletion of a shape, or a change of its properties (line, lens, fill, size, position…).

Syntax

Private Sub object_Modified()

Remarks

This event fires whenever Modified property is changed from 'False' to 'True'. (from the process, not programmatically). Those modifications may not be visible, but the Modified event occurs anyway.

When a new drawing is created, its Modified property is set to 'False'. When something is changed, the Modified property is set to 'True' and the Modified event is fired. Further changes do not cause the Modified event to fire until the Modified property is set to 'False'. To cause the Modified event to be fired every time a change is made, set the Modified property to 'False' within the Modified event handler.


MouseDown / MouseUp (Event)

See Also	Applies To	Example

Occurs when the user presses (MouseDown) or releases (MouseUp) a mouse button.

Syntax

Private Sub object_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)

Private Sub object_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)

The MouseDown event syntax has these parts:

Part	Description

Button	Returns an integer that identifies the button that was pressed (MouseDown) or released (MouseUp) to cause the event. The button argument is a bit field with bits corresponding to the left button (bit 0), right button (bit 1), and middle button (bit 2). These bits correspond to the values 1, 2, and 4, respectively. Only one of the bits is set, indicating the button that caused the event.

Shift	Returns an integer that corresponds to the state of the SHIFT, CTRL, and ALT keys when the button specified in the button argument is pressed or released. A bit is set if the key is down. The shift argument is a bit field with the least-significant bits corresponding to the SHIFT key (bit 0), the CTRL key (bit 1), and the ALT key (bit 2 ). These bits correspond to the values 1, 2, and 4, respectively. The shift argument indicates the state of these keys. Some, all, or none of the bits can be set, indicating that some, all, or none of the keys are pressed. For example, if both CTRL and ALT were pressed, the value of shift would be 6.

x, y	Returns a number that specifies the current location of the mouse pointer. The x and y values are always expressed in terms of the coordinate system that is currently set.

Remarks

Use a MouseDown or MouseUp event procedure to specify actions that will occur when a given mouse button is pressed or released. Unlike the Click and DblClick events, MouseDown and MouseUp events enable you to distinguish between the left, right, and middle mouse buttons. You can also write code for mouse-keyboard combinations that use the SHIFT, CTRL, and ALT keyboard modifiers.

If you need to test for the button or shift arguments, you can use constants which define the bits within the argument. The constants act as bit masks that you can use to test for any combination of keys.

Note

You can use a MouseMove event procedure to respond to an event caused by moving the mouse. The button argument for MouseDown and MouseUp differs from the button argument used for MouseMove. For MouseDown and MouseUp, the button argument indicates exactly one button per event whereas for MouseMove, it indicates the current state of all buttons.


MouseMove (Event)

See Also	Applies To	Example

Occurs when the user moves the mouse.

Syntax

Private Sub object_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)

The MouseMove event syntax has these parts:

Part	Description

Button	An integer that corresponds to the state of the mouse buttons in which a bit is set if the button is down. The button argument is a bit field with bits corresponding to the left button (bit 0), right button (bit 1), and middle button (bit 2). These bits correspond to the values 1, 2, and 4, respectively. It indicates the complete state of the mouse buttons; some, all, or none of these three bits can be set, indicating that some, all, or none of the buttons are pressed.

Shift	An integer that corresponds to the state of the SHIFT, CTRL, and ALT keys. A bit is set if the key is down. The shift argument is a bit field with the least-significant bits corresponding to the SHIFT key (bit 0), the CTRL key (bit 1), and the ALT key (bit 2 ). These bits correspond to the values 1, 2, and 4, respectively. The shift argument indicates the state of these keys. Some, all, or none of the bits can be set, indicating that some, all, or none of the keys are pressed. For example, if both CTRL and ALT were pressed, the value of shift would be 6.

x, y	A number that specifies the current location of the mouse pointer. The x and y values are always expressed in terms of the coordinate system that is currently set.

Remarks

The MouseMove event is generated continually as the mouse pointer moves across the Polar Draw object. Unless another object has captured the mouse, Polar Draw object recognizes a MouseMove event whenever the mouse position is within its borders.

If you need to test for the button or shift arguments, you can use constants which define the bits within the argument. The constants act as bit masks that you can use to test for any combination of keys.

Note

You can use MouseDown and MouseUp event procedures to respond to events caused by pressing and releasing mouse buttons.

The button argument for MouseMove differs from the button argument for MouseDown and MouseUp. For MouseMove, the button argument indicates the current state of all buttons; a single MouseMove event can indicate that some, all, or no buttons are pressed. For MouseDown and MouseUp, the button argument indicates exactly one button per event.


RulerClicked (Event)

See Also	Applies To

Occurs when the user presses a mouse button over the control's ruler.

Syntax

Private Sub object_RulerClicked(nWhichRuler As Integer, nButton As Integer)

The RulerClicked event syntax has these parts:

Part	Description

nWhichRuler	Returns a number that indicates whether the vertical or horizontal ruler has been clicked.

nButton	Returns an integer that identifies the button that was pressed to cause the event. The button argument is a bit field with bits corresponding to the left button (bit 0), right button (bit 1), and middle button (bit 2). These bits correspond to the values 1, 2, and 4, respectively. Only one of the bits is set, indicating the button that caused the event.

Remarks

Parameter nWhichRuler returns a value that indicates which scrollbar has been clicked:

0 	 Horizontal

1 	 Vertical

2 	 Middle


ScrollBarClicked (Event)

See Also	Applies To

Occurs when the user presses a mouse button over the control's scrollbar.

Syntax

Private Sub object_ScrollBarClicked(nScrollBar As Integer, nButton As Integer)

The ScrollBarClicked event syntax has these parts:

Part	Description

nScrollBar	Returns a number that indicates whether the vertical or horizontal scrollbar has been clicked.

nButton	Returns an integer that identifies the button that was pressed to cause the event. The button argument is a bit field with bits corresponding to the left button (bit 0), right button (bit 1), and middle button (bit 2). These bits correspond to the values 1, 2, and 4, respectively. Only one of the bits is set, indicating the button that caused the event.

Remarks

Parameter nScrollBar returns a value that indicates which scrollbar has been clicked:

0 	 horizontal

1 	 vertical


SelectionChanged (Event)

See Also	Applies To

Occurs when the selection of the shapes is changed by user interaction.

Syntax

Private Sub object_SelectionChanged()

Note

This event triggers only if user changes the selection clicking on the shapes or canvas. It is NOT triggered when you change the selection ‘inside’ (programmatically)!


SelectionResized (Event)

See Also	Applies To

Occurs when the selection is resized (or rotated, or deformed by editing points) by the user interaction.

Syntax

Private Sub object_SelectionResized()

Remarks

This event fires not only when selection is resized, but each time the user edits the selection using the mouse (resizes it, rotates it or edits points).

Note

This event triggers only if the USER resizes the selection. It is NOT triggered when you resize, rotate or edit selection points ‘inside’ the program (programmatically)!


ShapeAdded (Event)

See Also	Applies To	Example

This event occurs whenever a new shape is added, whether it is added by Add method or manually by the user.

Syntax

Private Sub object_ShapeAdded(fProgramatically As Boolean, lShapeID As Long)

The ShapeAdded event syntax has these parts:

Part	Description

fProgramatically	Returns a value that indicates whether the shape was added by the Add method.

lShapeID	Returns sthe hape's identification number.

Remarks

Parameter fProgramatically returns a value that indicates whether the shape was added by the Add method:

True 	 The hape was added by the programmer, using the Add method

False 	 the shape was added by the user

Note

The difference between this event and BeforeShapeAdded is in the time when they are triggered. This event is triggered right after the new shape is added to the canvas and after all the formatting (fill, line, lens…) is applied to it. See Changing Format of Newly Added Shapes (Example) to see the difference.


ShapeClicked (Event)

See Also	Applies To

Occurs when the user presses and then releases a mouse button over Polar Draw shape.

Syntax

Private Sub object_ShapeClicked(lShapeID As Long, nButton As Integer, nMask As Integer)

The ShapeClicked event syntax has these parts:

Part	Description

lShapeID	A numeric expression that uniquely identifies a shape. It can be retrieved using the ID property of the Shape object, or you can retrieve the shape with the given ID from the Shapes collection using the ItemFromID method

nButton	Returns an integer that identifies the button that was pressed to cause the event. The button argument is a bit field with bits corresponding to the left button (bit 0), right button (bit 1), and middle button (bit 2). These bits correspond to the values 1, 2, and 4, respectively. Only one of the bits is set, indicating the button that caused the event.

nMask	Returns an integer that corresponds to the state of the SHIFT, CTRL, and ALT keys when the button specified in the button argument is pressed or released. A bit is set if the key is down. The shift argument is a bit field with the least-significant bits corresponding to the SHIFT key (bit 0), the CTRL key (bit 1), and the ALT key (bit 2 ). These bits correspond to the values 1, 2, and 4, respectively. The shift argument indicates the state of these keys. Some, all, or none of the bits can be set, indicating that some, all, or none of the keys are pressed. For example, if both CTRL and ALT are pressed, the value of shift would be 6.

Remarks

This event triggers each time when the user clicks on the existing shape (not while creating it). If the EditMode property is set to polCreateNew or polEditPoints, this event will not trigger. This event will also fail to trigger if the  AllowSelect property is set to 'False'. Values returned through this event let you know about the shape that was clicked and the mouse button that triggered the event.

Note:

It is important that this event triggers only if the user clicks on the shape and not anywhere else inside the bounding box.


Constants (Visual Basic only):

The constants act as bit masks you can use to test for any combination of buttons without having to figure out the unique bit field value for each combination.

Button	Description

vbLeftButton = 1	Left button is pressed

vbRightButton = 2	Right button is pressed

vbMiddleButton = 4	Middle button is pressed

Shift	Description

vbShiftMask = 1	SHIFT key is pressed.

vbCtrlMask = 2	CTRL key is pressed.

vbAltMask = 4	ALT key is pressed.


BeforeShapeAdded (Event)

See Also	Applies To	Example

This event occurs whenever a new shape is added, whether it is added by the Add method, manually, or by the user.

Syntax

Private Sub object_BeforeShapeAdded(fProgramatically As Boolean, lShapeID As Long)

The BeforeShapeAdded event syntax has these parts:

Part	Description

fProgramatically	Returns a value that indicates whether the shape is added by the Add method.

lShapeID	Returns the shape's identification number.

Remarks

Parameter fProgramatically returns a value that indicates whether the shape is added by the Add method:

True 	 The shape was added by the programmer using the Add method

False 	 The shape was added by the user

Note

The difference between this event and the ShapeAdded is in the time when they are triggered. This event is triggered just before the new shape is added to the canvas and before any formatting is applied to it. See the Changing Format of Newly Added Shapes (Example) example to see the difference.


HyperlinkClicked (Event)

See Also	Applies To 	Example

Occurs when the user presses a mouse button over the shape which is a hyperlink.

Syntax

Private Sub object_HyperlinkClicked(lShapeID As Long, nButton As Integer, nMask As Integer)

The HyperlinkClicked event syntax consists of  the following parts:

Part	Description

lShapeID	ID of the shape which has been clicked

nButton	Returns an integer that identifies the button that was pressed to cause the event. The button argument is a bit field with bits corresponding to the left button (bit 0), right button (bit 1), and middle button (bit 2). These bits correspond to the values 1, 2, and 4, respectively. Only one of the bits is set, indicating the button that caused the event.

nMask	Returns an integer that corresponds to the state of the SHIFT, CTRL, and ALT keys when the button specified in the button argument is pressed or released. A bit is set if the key is down. The shift argument is a bit field with the least-significant bits corresponding to the SHIFT key (bit 0), the CTRL key (bit 1), and the ALT key (bit 2 ). These bits correspond to the values 1, 2, and 4, respectively. The shift argument indicates the state of these keys. Some, all, or none of the bits can be set, indicating that some, all, or none of the keys are pressed. For example, if both CTRL and ALT are pressed, the value of shift would be 6.

Remarks

This event is useful to catch if you want to apply the Follow method of the hyperlink on each click, for example. Whenever the shape containing hyperlink attributes is clicked, this event fires.

Note

It is important to know that this event does not fire in polCreateNew and polView EditModes. For polFreeform shapes it is not triggered in polEditPoints mode either.


Selection (Object)

See Also	Properties	Methods

The Selection object represents the current selection on the page.

Remarks

The Selection object can be retrieved from the Page object. In the current version of Polar Draw , only the shapes can selected, but in future versions, we will have distinguished selected shapes from the Selection object. Selected shapes can be retrieved from the Selection object using the ShapeRange property.


ShapeRange (Property)

See Also	Applies To

Returns ShapeRange collection object that contains the range of selected shapes.

Syntax

ShapeRange As ShapeRange

Remarks

When you are working with a selection, bare in mind that once created, the ShapeRange collection contains only the currently selected shapes. When the selection changes, your object of the ShapeRange type will not follow changes!

For example, when the selection contains the shapes with IDs 1, 3 and 4, the pd_Range object defined as Selection.ShapeRange will also contain the shapes 1, 3 and 4. After the end-user (or even your program) changes the selection, and selects the shapes 4 and 5, the pd_Range object will still represent shapes 1, 3 and 4.


Clear (Method)

See Also	Applies To

Clears current selection.

Syntax

Sub Clear()

Remarks

This method does not delete the objects in selection. It just removes them from the selection. Applying this method will affect the ShapeRange from the selection. ShapeRange.Count will be zero.


ShapeRange (Collection Object)

See Also	Properties	Methods

The ShapeRange object is a collection of objects containing specific ranges of shapes.

Remarks

You can retrieve this collection using the ShapeRange property of the Selection object, or using the Range method from the Shapes collection.

Retrieved from the Selection object, the ShapeRange represents all shapes in the current selection (See Note).

To retrieve a specific shape from this collection, use the Item method and specify the shape by its position in the Z order.

You can also use this object to apply the same formatting to all shapes in a range because you can retrieve almost all objects that refer to a shape’s format from the ShapeRange: Fill, Line, Arrows, Shadow, Lock...

Important

The Setting properties of ,for example, the Fill object, will influence the Fill format of all the shapes in a range. When retrieving those properties, you will get only the values that are referring to one shape from the range. That is the shape with the lowest position in the z-order.

Note

When you are working with a selection, have in mind that once created, the ShapeRange collection contains only the currently selected shapes. When the selection changes, your object of ShapeRange type will not follow the changes! For example, when the selection contains shapes with IDs 1, 3 and 4, the pd_Range object defined as Selection.ShapeRange will also contain shapes 1, 3 and 4. After the end-user (or even your program) changes the selection and selects shapes 4 and 5, the pd_Range object will still represent shapes 1, 3 and 4.


GetBoundingRect (Method)

See Also	Applies To

Use this method to retrieve the coordinates of the top-left and bottom-right corner of the rectangle that contains all the shapes in the range.

Syntax

Sub GetBoundingRect(plLeft As Long, plTop As Long, plRight As Long, plBottom As Long)

The GetBoundingRect method syntax consists of the following parts:

Part	Description

plLeft	A number that specifies the horizontal coordinate of the top-left corner.

plTop	A number that specifies the vertical coordinate of the top-left corner.

plRight	A number that specifies the horizontal coordinate of the bottom-right corner.

plBottom	A number that specifies the vertical coordinate of the bottom-right corner.

Remarks

Coordinates of the bounding rectangle are returned through the plLeft, plTop, plRight and plBottom parameters. Each of them has to be declared separately.

Note

Coordinates of this rectangle will not be the same as values retrieved with the Left, Top, Right and Bottom properties. Those properties return just coordinates from the shape with the lowest position in the z-order.

Example

'declaration of parameters

Dim A As Long

Dim B As Long

Dim C As Long

Dim D As Long

POLARDraw1.ActivePage.Selection.ShapeRange.GetBoundingRect A, B, C, D

'MessageBox will display coordinates of the bounding rectangle

MsgBox CStr(A) ", " CStr(B) ", " CStr(C) ", " CStr(D)


Group (Method)

See Also	Applies To

Groups the shapes in the specified range. Returns the grouped shapes as a single Shape object.

Syntax

Sub Group() As Shape

Remarks

When creating a group of shapes, the position of the group in the z-order becomes the biggest in the Shapes collection. The created group comes to the top of all other shapes.

Because a group of shapes is treated as a single object, grouping and ungrouping shapes changes the number of items in the Shapes collection and changes the index numbers of items that come after the affected items in the collection.


 Font (Object)

See Also	Properties

The Font object contains the font attributes (font name, font size, color, and so on) for an object.

Remarks

Use the Font property of the Text object to return the Font object.

Use this object to set the Font attributes of the polPlainText shape. If you are using some other shape-types and want to set the text in it using the Plain property, first set the  Font object attributes.

You can also use the  FontDlg method to enable your users to automatically change the font attributes of the polPlainText shapes.

Note

Changing the font attributes of shapes different than the polPlainText shapes is not visible until you set the text by using the Plain property. Here is the explanation:

When you want to set the text in the rectangle (for example), you can do this using the Plain or using the RTFText. When you use the RTFText property, that text is already RTF formatted, but when you use the Plain property, Polar Draw first reads the Font object's attributes and then creates a RTFtext property value with the text from the Plain property and the formatting from the Font object.

That is why the Font object is considered only before setting the Plain property.

Example

Here is an of example how to format the font attributes before setting the PlainText property to all selected shapes:

Private Sub btnSetPlain_Click()

Dim pd_ShapeRange As POLARDRAW20Lib.ShapeRange

Set pd_ShapeRange = POLARDraw1.ActivePage.Selection.ShapeRange

With pd_ShapeRange.Text.Font

.Name = "Arial"

.Bold = True

.Italic = False

.Underline = True

.Size = 12

End With

pd_ShapeRange.Text.Plain = "Just Simple formatted text: Arial, Size = 12, Bold, Underline"

End Sub


Bold (Property)

See Also	Applies To	Example

Sets and returns whether the  font is formatted as bold.

Syntax

Bold [ = fNewValue] As Boolean

Bold property syntax consists of the following parts:

Part	Description

fNewValue	A Boolean expression determines whether the font is formatted as bold or not.

Plain


Italic (Property)

See Also	Applies To	Example

Sets and returns whether the font is formatted as italic.

Syntax

Italic [ = fNewValue] As Boolean

Italic property syntax consists of the following parts:

Part	Description

fNewValue	A Boolean expression determines whether the font is formatted as italic or not.


Strikethrough (Property)

See Also	Applies To	Example

Sets and returns whether the font is formatted as strikethrough text.

Syntax

Strikethrough [ = fNewValue] As Boolean

Strikethrough property syntax consists of the following:

Part	Description

fNewValue	A Boolean expression determines whether the font is formatted as strikethrough, or not.


Underline (Property)

See Also	Applies To	Example

Sets and returns whether the font is formatted as underlined text.

Syntax

Underline [ = fNewValue] As Boolean

Underline property syntax consists of the following parts:

Part	Description

fNewValue	A Boolean expression determines whether the font is formatted as underline, or not.


Name (Property)

See Also	Applies To	Example

Sets and returns the Font Name.

Syntax

Name [ = name] As String

Name property syntax consists of the following parts:

Part	Description

name	A string expression defining the the font name.

Remarks

This property is the default property for the Font object, so you can simply write:

PD_ShapeRange.Text.Font = “Arial”

Instead of:

PD_ShapeRange.Text.Font.Name = “Arial”

If the specified name does not exist, Windows maps to a predictable and useful font with same the attributes.


Size (Property)

See Also	Applies To	Example

Returns or sets the the font size ( in points ).

Syntax

Size [ = number] As Long

Size property syntax consists of the following parts:

Part	Description

number	Numeric expression (expressed in points).


Hyperlink (Object)

See Also	Properties	Methods

Represents a hyperlink.

Remarks

Use the Hyperlinkproperty to return a Hyperlink object associated with a shape or a shape range (each shape can have only one hyperlink).

The following example activates the hyperlink associated with the shape which has been clicked.

Private Sub btnAddHyperlink_Click()

POLARDraw1.HyperlinkBase = txtBase

pd_selection.ShapeRange.AddHyperlink

With pd_selection.ShapeRange.Hyperlink

.Address = txtAddress

.ExtraInfo = txtExtra

.ShowHandCursor = chckShowHand.Value

End With

End Sub

Private Sub POLARDraw1_ShapeClicked(ByVal lShapeID As Long, ByVal nButton As Integer, ByVal nMask As Integer)

With pd_selection.ShapeRange.Hyperlink

If .ShowHandCursor = True Then

txtAddress = .Address

txtExtra = .ExtraInfo

If .Follow = False Then MsgBox "Unseccesfull Jump"

End If

End With

End Sub


Address (Property)

See Also	Applies To	Example

Sets and returns the address (for example, a file name or URL) of the specified hyperlink.

Syntax

Address [ = string] As String

Address property syntax consists of the following parts:

Part	Description

string	A string expression representing the address to follow.

Remarks

Set this property to assign the address which will be followed when you use the Follow method. The address can be a file name (with its path), or URL.

It is also useful to know that you can set the HyperlinkBase property which allows you to define the same root for each hyperlink on the active document. This is helpful when you are analyzing a web site.

For example. If all hyperlink shapes are going to point to the same web site, you can set the HyperlinkBase to the site URL and each shape will have to carry only the relative address in the Address property.

Example:

PolarDraw1.HyperlinkBase = “www.polarsoftware.com/”

PolarDraw1.ActivaPage.Shapes(1).AddHyperlink

PolarDraw1.ActivaPage.Shapes(1).Hyperlink.Address = “draw.html”

Polar Draw will join the HyperlinkBase and the Address values to just one string:

”www.polarsoftware.com/draw.html”


ExtraInfo (Property)

See Also	Applies To	Example

Sets and returns the additional information for the hyperlink.

Syntax

ExtraInfo [ = string] As String

ExtraInfo property syntax consists of the following parts:

Part	Description

string	A string expression representing the additional info.

Remarks

The ExtraInfo property returns or sets the extra URL request information used to resolve the hyperlink's URL.

Setting the ExtraInfo property of a shape's Hyperlink object is optional. You might, for example, set the Hyperlink object's ExtraInfo property to the coordinates of an image map, the contents of a form, or a file name.

If the ExtraInfo property you provide contains reserved characters other than spaces, they must be escaped.

HyperlinkBase, Address and ExtraInfo are joind together to one string with a space between the  Address and ExtraInfo.


ShowHandCursor (Property)

See Also	Applies To	Example

Sets and returns the flag that determines whether the Hand cursor will be shown when moving the mouse over the shape with the associated hyperlink.

Syntax

ShowHandCursor [ = fNewValue] As Boolean

ShowHandCursor property syntax consists of the following parts:

Part	Description

fNewValue	A Boolean expression that represents whether the hand cursor will be shown or not.

Remarks

If you set this property to 'True', the hand cursor will be shown each time you move the mouse over the shape with the associated hyperlink. This does not mean that clicking on the shape will automatically activate the hyperlink (you must use the Follow method for really following the link).

The Hand cursor will be visible only in the  polResize, polRotate and polEditPoints modes. For the polFreeform shapes, the  hand cursor is not visible in the polEditPoints mode.


Follow (Method)

See Also	Applies To	Example

The Follow method causes the shape to navigate to a hyperlink.

Syntax

Function Follow() As Boolean

Remarks

This method activates the hyperlink. You can apply this method on the ShapeClicked.

Event.


FAQ
Frequently Asked Questions

General - about payment and conditions of use trial version

Troubleshooting with control registering

Supported file formats - importing/exporting

Speed of performance and memory...

How to...

General - About Payment and Conditions of Use Trial Version

What are the limits of the trial version?

Trial versions of all our components are completely functional. The only difference between the trial and the full version are nagging pop-up screens. This means you have all the functionality in a trial version as you do in the release.

Please specify how I can order your product?

You can order Polar products Online (Polar Draw can be ordered at http://www.polarsoftware.com/catalog.asp?id=9), by E-mail (sales@polarsoftware.com) or via resellers (see http://www.polarsoftware.com/resellers.html).

If you have more queries about the order, please feel free to contact our sales department at sales@polarsoftware.com.

What types of payment do you accept?

You can pay

-	using credit cards: Visa, MasterCard, American Express;

-	by Wire Transfer and

-	(Company) Check.

If you have more queries about the order, please feel free to contact our sales department at sales@polarsoftware.com.

How do you deliver your products?

Polar Software products are now available only through ESD.

If I buy the component now, will I be entitled to the coming versions at no extra cost?

Minor versions will be free for anyone who ordered the last major version. Further major versions will be available as an upgrade (at an acceptable price).

Are the License numbers or quantities of copies referring to developers or end users of the software that contain the Polar Draw ActiveX control?

The number of licenses refers to the number of developer's machines, while redistribution with your application is free. There are no royalty fees either for Polar Draw, nor for any of our components. They are all royalty free, although one software license is required per developer's machine.

Troubleshooting With Control Registering

If I try to install your demo file (POLARDraw.ocx) without your installation procedure, the ActiveX file does not work. (If I install it with: regsvr32 POLARDraw.ocx) Is it possible to install it without your installation software?

The re-distribution of Polar Draw ActiveX controls is explained in the ReadMe file (comes with the installation). Some extra files are needed for registering the Polar draw OCX. Those files are:

MFC42.DLL

MSVCRT.DLL

MSVCP60.DLL

So once you complete the installation procedure, you must copy these files to the end-user's system directory and then register the control.

I purchased a new computer, I have installed Polar Draw ActiveX control on my computer and registered POLARDraw.ocx success fully but when I try to use this in VB6 it shows me the error message : "License information not found. You do not have permission to use this component in design environment."

The reason you could not use Polar Draw is because a license file is missing. It is possible you moved the OCX file to some other directory, but you did not move the LIC file. (It is needed while developing, but is not re-distributable!)  Therefor, move the lic file to the same location where the OCX file is.

I downloaded the POLAR Draw zip.
Ran Setup.
Copied POLARDraw.ocx to winnt\system32.
I have loaded all the required DLL's.
Problem: I could not register the Active X control. Error message received: "specified module could not be found".

There are a few possible causes and solutions:

a) When you copied the control to the WIN\SYS directory it is possible that you removed the control from the directory where it was installed. It should not be removed because Windows searches for the control using registry entries which contain the control's path, unlike DLLs which must be located in system directory. If you move the control, you have to re-register it in a new directory.

b) If you just made a new copy of POLARDraw.ocx in WIN\SYS and registered it, It is possible that the previous copy of Polar Draw OCX remained registered, so you have to unregister it. (Because Polar Draw setup registered Polar Draw in its own directory, during the installation.)

If I want to upgrade an existing ActiveX control, what will happen after I download and install it? Is it going to overwrite existing files or it will exist as the new version?.

When you install a new version, you can choose a different folder to install in, but the new version will be registered and your system will recognize just this registered one. Therfor, you can keep the two different versions of the control on your computer, but you must keep in mind that you must register the control manually each time you want to switch from one to the other.

If you were using Polar Draw version 1.x and than installed version 2.0, both controls can be registered at the same time because they have different UUIDs. This means you will even be able  to use two different versions of the controls in the same application!

Supported File Formats - Importing/Exporting

Which file formats are supported by Polar Draw?

Polar Draw ActiveX control can save drawings in its own (PDR) format and as Enhanced Metafiles (EMF). Support for saving files in BMP format (and maybe some other formats) will be added in future versions.

What is the PDR file format?

PDR means Polar Draw format.

Polar Draw can save to a metafile but it does not seem to be able to open a metafile. Is that correct? Do you plan on adding that feature?

You can save Polar Draw picture as a metafile, but you ca not open it. However,  you can always import the metafile like a picture (create a rectangle and fill it with the metafile you want to open), or simply use the function AddPicture or AddPictureFromObj (You can see this in a PicViewer sample).

Can I import AutoCAD or other vector (CDR, etc) files into a Polar Draw object?

Unfortunately, you cannot import AutoCAD files to Polar Draw. It is possible to import BMPs and metafiles (WMF and EMF) and if you are working with Visual Basic, you can even import GIFs and JPEGs.

How can I import a HPGL file?

Unfortunately, you cannot import an HPGL file to Polar Draw. You can only use the copy/paste options, although the HPGL will be pasted to the Polar Draw in the WMF format.

Speed of Performance and Memory...

I need to draw and manipulate more than 600 different shapes in my program. Can I improve the performance by adding memory?

Unfortunately, adding memory will not make a noticable difference. Manipulating 600 shapes is slower, but should still be possible.

Our advice is the following:

-	Use shape filling with a solid color because it is the fastest way. (Filling with shading is the slowest.)

-	When you fill, rotate, or perform any other action on a couple of selected shapes, it will be much faster to perform it using ShapeRange object, then to perform these actions on each shape separately.

-	When you are dealing with a large number of shapes and use methods for manipulating a selection, the performance may be very slow because of the Undo recording. You can disable this option by setting the RecordUndo property to 'False', or  by decreasing the number of recorded undos using the  UndoSize property.

Will DeleteShape/DeleteSelection functions remove the shape from both screen and memory?

The DeleteShape/DeleteSelection functions remove the shapes from the memory, so there is no fear that the removed shapes will take up space in memory.

I would like to know the maximum number of shapes that can be created.

There is no special memory limitation for the number of shapes on the drawing.

I am using VB6, and I draw graphs on a picture box using the line method to connect thousands of points to make iterative smooth curves. Is your tool based on the VB picture box or is it faster than a picture box when used in VB? I have one case where it takes 45 seconds to draw the curves on a 200mhz machine. Would I expect your tool to be faster or slower and why?

Polar Draw is not based on the VB picture box but that makes it (unfortunately) even slower than the simple picture box. Polar Draw is made for drawing and formatting individual shapes, so it treats each shape as an object. Drawing 1000s of lines needs the creation of 1000s of objects, which is why Polar Draw needs more time for drawing than the picture box. However, if you need more complex functions, such as rotation, translation or formatting individual shapes (lens effects e.g.), Polar Draw will speed up your application more than any other control.

I am testing the trial version on Polar Draw OCX in VB6 on large graphs (50 shapes) and noticed that it takes too long to draw the graph and too long to scroll. I tried turning EnableRendering to 'False' without any perceptual effect. Are there any other things to try?

It is not so strange for Polar Draw to slow down when dealing with large amounts of shapes, because Polar Draw is designed for interactive drawing and not for creating fast graphics. (Corel Draw and MS Word Drawing Layer were our models in making this control). But we can give you a few helpful suggestions when you are manipulating with large number of shapes:

-	- Use fill the shape using a solid color as it is the fastest way. (Filling with shading is the slowest.)

-	When you fill, rotate, or perform any other action on a couple of selected shapes, it will be much faster then to perform these actions on each shape separately.

-	When you are dealing with a large number of shapes and use methods for manipulating a selection, performance may be very slow because of the Undo recording. You can disable this option by setting the RecordUndo property to 'False', or at least by decreasing the number of recorded undos using the UndoSize property.

How To…

Does Polar Draw allow me to programmatically show a different background grid system? Like a pie segment? And does it allow me to program the snap to grid?

Polar Draw can only display a rectangular grid. It allows you to show a grid ('ShowGrid' property), choose vertical and horizontal spacing between the gridlines (VerticalGrid and HorizontalGrid), the color of the grid lines (GridColor) and to choose whether the shapes will snap to grid (SnapToGrid).

Can I program how shapes are resized (proportionally, horizontally, vertically, and angularly)?

Shapes can be resized and rotated manually, or you can set the position and rotation of shapes directly from your program. However, programming the way the users interact is impossible. When you set the EditMode to polResize, the response to the user's action is defined and cannot be changed.

Can I program the point of rotation of objects to be off center or at any point along the edge or within the surface area and make this available to the user of my application?

Programmatically, you can rotate the shape around any point (see 'RotateAroundPoint' and 'Rotate'), although your end users can only rotate shapes around the center.

Can I specify the line thickness and save the values in buttons? I presume the button saving is part of the windows development environment. So I guess I'm asking if all your variables are available to the programming language?

The line thickness is defined in the  ‘Width' property of the Line object. All other variables can be accessed using the properties.

Can the rulers be changed so that they read , for example,  300 to 500 for say the horizontal and say 10.6 to 14.7 for the vertical?

Unfortunately this is impossible. You can choose the measurement units for the ruler and set the zoom parameter but that is all.

Can I programmatically affect the edit mode I choose? For example while in polEditPoints mode, can I move the 3rd point up 2 mm from "inside the box", or from code rather than when the user mouse clicks?

Yes, it is possible to add and edit polygon points (through Vertices collection).

My interest in this product involves the desire to plot mapping data in any of 180 different map projections onto the canvas and allow the user to modify the graphic after the mapping routines have finished drawing. However, after working with your demo it seems that the only thing the OCX responds to is drawing with the mouse? Is that the case?

I gather that you need to add drawings (shapes) programmatically and than allow the user to modify the drawing you added. This is possible if you use the Add method of the Shapes collection object (or other methods like AddText, AddPicture…). Among the other available methods you should be able to find some that will help you to manage the shapes 'inside':

I am mostly concerned about the turning off the grip handles while being able to select the shapes. (if this is possible).

You can set the ShowSelection property to 'False' and no selection handles will be displayed.

How can I set the default "plain text" font and size to fit my application?

"Plain text" can be changed only AFTER the text is added (so practically, you can not set the Default font and size).However, you can catch the event ShapeAdded (or BeforeShapeAdded) and then set the Font object properties. If you want your users to add text in a specific font and size, you can also set the font in the event ShapeAdded procedure. What the user will see is text written in the font determined by Polar Draw until after he/she clicks somewhere else (ShapeAdded fires) and causing the text to be changed to the font that you set.

I have a question about the method 'GetShapeOnPoint'. Am I right if I use this method in a 'MouseDown'-event (using the x and y coordinates) to find out if a certain shape is under the cursor? It does not seem to work in this routine; I get the coordinates, but the shape's ID is '-1' (no shape) even if I click anywhere on a shape. Am I getting the purpose of this method wrong?

The 'GetShapeOnPoint' method needs two parameters (X and Y coordinates: position of the shape) that are expressed in measurement units currently set in Polar Draw (MeasurementUnits property). The 'MouseDown' event (if you are working in VB) retrieves coordinates of the current mouse position in twips, so you must synchronize the units of the MouseDown event with the units needed for parameters in the GetShapeOnPoint method.

Also, the MouseDown event returns coordinates respective to the canvas origin, while GetShapeOnPoint needs parameters respective to the page origin.

Here is the example:

Private Sub PolarDraw_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)

Dim x1 As Long	'mouse coordinate

Dim y1 As Long	'mouse coordinate

Dim shapeID As Long

Dim old_units As Long

Dim pd_shape As POLARDRAW20Lib.Shape

x1 = x

y1 = y

old_unit = POLARDraw.MeasurementUnits	'remembering old units

POLARDraw.MeasurementUnits = polUnitsTwips

'setting Measurement Units
'to twips, because x and y
'are expressed in twips

POLARDraw.ActiveWindow.UnitsToPixels x1, y1

'converting units to pixels because WindowToPage method

'receives parameters expressed in pixels

POLARDraw.MeasurementUnits = old_unit

'returning old units back

POLARDraw.ActiveWindow.WindowToPage x1, y1

'calculating position
'of the mouse pointer
'in respect to the page

If POLARDraw1.ActivePage.GetShapeOnPoint(x1, y1) Is Nothing Then Exit Sub

Set pd_shape = POLARDraw1.ActivePage.GetShapeOnPoint(x1, y1)

MsgBox CStr(pd_shape.ID)

Set pd_shape = Nothing

End Sub

However, the best way to determine whether the shape is clicked is to use the ShapeClicked event.

How do I lock the cursor for horizontal or vertical line drawing (same AutoCAD Ortho On).

Unfortunately, there is no way to do this in Polar Draw. (At least for now.)

We would like to know if Polar Draw supports any other language than English.

We also have Polar Draw with German resources.

We work in projects that need precision, and we observed that the control does not support decimals in the points of polygons and we would like to know if this problem has a solution.

This is true. Polygon point coordinates must be integer values. I can only suggest you  use twips as measurement units although this is not very helpful when working with polygons because polygon points are relative to the bounding box. We are sorry if this is not what you expected, but Polar Draw is made for designing and  not for mathematical drawings which demand precision.

Is it possible to rotate the images with your product after putting them in the active document?

No, it is not possible to rotate images that are imported to the Polar Draw document. (You can rotate just a shape and  not the image).

Is it possible to save the document with an extension I can choose by myself?

Yes, you can save the document with the extension you have chosen. However, it will be saved in a format predefined with Polar Draw. (e.g. you can save the drawing as a bitmap - *.bmp, but it will not be recognized as a bitmap.)

Can your product be used to create and save GIF files? Can it create and save animated GIF files?

Unfortunately, Polar Draw is not able to manipulate GIFs. You can only paste GIFs into Polar Draw, but they will be transferred into Draw document as a metafile. Animated GIFs cannot be made with Polar Draw.

My question arises if I want to place a different object on your canvas. Is this possible? If so, is it easily done?

Polar Draw offers you the ability to add predefined shapes, to stretch them, move, etc. If you want to add a picture from another drawing application, you can draw a shape and fill it with that picture (if it is in BMP, JPEG, WMF, EMF or GIF format). If you were not refering to these kinds of objects but OLE objects, then it is not possible to import an OLE object to the Polar Draw canvas.

Are there options of layers?

Unfortunately, there are no options of layers.

Is it possible to use Polar Draw as a drawing tool within MS-Access97? I only need to draw a polygon based on the result of a query, which returns the x, y-coordinates?

Yes, Polar Draw can easily be used with MSAccess. For your example, use the AddPolygon method.

Can a user interactively change an existing polygon; i.e. add/delete polygon points and store the result into a database?

Yes, users can interactively move, add and delete polygon points.

Is it possible to have a background picture (as shown in the PictureViewer example) on which I can let the user draw a number of polygons interactively?

The background can be displayed in any color, but for displaying a picture in the background, you must create a shape that will play a 'background role', fill it with the picture, disable moving and selection for that shape, and you have a picture in the background!

Set pd_shapes = POLARDraw1.ActivePage.Shapes

Set pd_background = pd_shapes.AddPictureFromObj(LoadPicture("background.jpg"), 0, 0, 100, 100)

With pd_background

.Lock.AgainstRotation = True

.Lock.AgainstSelection = True

End With

The initial line consists of a start/end point which should not be moved. What is the best way to disable a user from moving the start/end point?

You can check inside the MouseDown event if the user clicked in the area around the start/end point, and than disable editing until the MouseUp event. (AllowEditPoints)

Is it possible to convert text to graphic?

Text can be converted to graphic if you save the drawing made by Polar Draw in the EMF format. (This can also be made over the clipboard).

I want to transfer different (Shape Text) from WordArt to my application.

If you mean to import WordArt as a shape in Polar Draw, it is possible with clipboard actions (copy-paste).

The problem when transferring WordArt to my app (through Clipboard) is that WordArt gives a Bitmap image of the text that is not sharp.

We can not help here because when you import WordArt into Polar Draw it will be in the form of a metafile and you will not be able to change it any more (in Polar Draw).

When I copy/paste a RTF text from a RTF text box to Polar Draw, Is it already in a metafile format? Or do I have to convert it to a metafile before I could paste it into Polar Draw?

Everything FROM Polar Draw can be pasted to RichTextBox, and it is pasted in metafile format (without an additional conversion).

Is there any way to change the cursor that is displayed when over a shape? I would like to be able to have the user select a color to apply to the shape and have it fill with that color. So when they go to click the shape it would be a single arrow instead of the move arrow.

Unfortunately, there is no such a function in Polar Draw that enables you to change the cursor. It is possible that a future version will fire such an event when the mouse pointer is over the shape. Then you will have the ability to change the mouse pointer while the user drags it over the shape.

I have two problems:

1. Printing a picture containing grey colors on a HP LaserJet 6MP results in the picture being printed black.

2. Printing a picture in color on a HP DeskJet 870Cxi results ina picture containing only red and blue colors.

It is possible that the problem that appears while printing can be removed by changing the  settings in the printer driver. Be sure that your printer is set to print pictures using raster graphics (not vector graphics). Also, if printing text, select "Print TrueType as graphics".

Can I resize the Viewport to remove the scroll bars and not to have such a large canvas area?

The canvas is the total area available for drawing. It may be larger than the window of the control. The viewport is the visible part of canvas, i.e. the part of the canvas displayed in the window. If the canvas has the same size as the viewport than there is nothing to scroll,although the scroll bars remain visible (there is no "thumb" to click on the scroll bar). To remove the scroll bars and rulers, use the following properties:

ShowVerticalRuler
ShowHorizontalRuler
ShowVerticalScrollBar
ShowHorizontalScrollBar

or just turn them off in the Properties window in VB. Also, be aware that the CanvasWidth, CanvasHeight and other properties that receive and return dimensions or coordinates use current measurement units when interpreting parameters. For example:

PolarDraw1.MeasurementUnits = polUnitsMilimeter
PolarDraw1.ActivePage.CanvasWidth = 1000

PolarDraw1.ActivePage.CanvasHeight= 1000

and

PolarDraw1.MeasurementUnits = polUnitsCentimeter
PolarDraw1.ActivePage.CanvasWidth = 1000

PolarDraw1.ActivePage.CanvasHeight= 1000

will have different results.

Is there a way to detect if the drawing has changed? For example, if I save it to file and than add another line, is there a way to detect that there was a change?

Every time the drawing changes, the Modified event is fired (and the Modified property is set to 'True'). Further changes do not cause the Modified event to fire until the Modified property is set to 'False'. To cause the Modified event to be fired every time a change is made, set the Modified property to 'False' within the Modified event handler.

You can also use the ShapeAdded event to get to know if a new shape has been added.

I am not sure how to initialize this OCX and put it on the form (in VB I can put it on the form by the manual).

1.	Create a standard MDI MFC project (for example MyApp), and on the last page of the Wizard click on the name of a View class (for example CMyAppView). Select CFormView as the base class for this class

2.	Go to the menu Project-AddToProject-Components And Controls. A dialog box will appear. Select "Registered ActiveX controls" and select Polar Draw ActiveX control.

3.	Click the Resources tab in the Workspace pane. Select the dialog form for your view (for example IDD_MYAPP_FORM). Click on the Polar Draw ActiveX control on tool palette and add the control to the dialog. This part is essentially the same as in VB. You can change the default name for the control ( the default name is IDC_POLARDRAWCTRL1)

4.	Go to the ClassWizard (menu View-ClassWizard) and click the "Member Variables" tab. On the list of control IDs, select IDC_POLARDRAWCTRL1 (or another name if you have changed it) and click the "Add Variable..." button. Type the name of the variable that will represent the control (for example m_PolarDraw). Now you can access all of the control's functions through this name. For example:

m_PolarDraw.SetEditMode( polCreateNew );
m_PolarDraw.Render();


Getting started in Microsoft Visual Basic

In order to insert Polar Draw ActiveX Control in your project, follow these steps:

1.	Install component on your system by starting its setup program.

2.	In Visual Basic compiler IDE create new project or open existing one.

3.	Click right mouse button over Toolbox toolbar to get popup menu.

4.	In menu choose "Components…" option to start dialog.

5.	Find "POLAR Draw ActiveX control module" in dialog's list of available controls, and select check-box on it's right.

6.	Click "OK" to leave the dialog.

7.	Now you can see icon [image] on a Toolbox toolbar, representing control that you chose.

8.	You can use control just like any other Windows control, e.g. you can:

1. Draw control in dialog resource as a child control,	or

2. Manually add member object in your dialog form.


Getting started in Microsoft Visual C++

This article is a step-by-step explanation of how to create a drawing application in VC++ 5.0 using the Polar Draw ActiveX control. The sample application which comes with the control was created exactly the same way. Although this description seems long, it shouldn’t take more than 2-3 minutes for medium experienced user.

1. Start  Visual C++;

2. Go to File menu , click New

3. On the New dialog, click Projects tab and select MFC AppWizard (exe)

4. In the Project Name edit box type the name for your application ( e.g.  Draw).

Leave other options as they are. Click OK button. MFC AppWizard will appear.

5.  On the Step 1 dialog of the AppWizard, click Multiple documents radio button.

Click Next.

6. On the Step 2 and Step 3 dialogs of the AppWizard, click Next.

7. On the Step 4 dialog of the AppWizard, clear the Printing and print preview check box, because Polar Draw ActiveX control is by default WYSIWIG. Click Next.

8. On the Step 5 dialog of the AppWizard, click Next.

9. On the Step 6 do the following:

On the list of generated classes select the view class (if you named your application “Draw”, the view class’ name will be CDravView).

From the Base class list box, select CformView for the base class of CdrawView.

Click Finish.

The New Project Information dialog will apear. Click OK to create the files.

10. Go to Project menu,  select Add To Project | Components And Controls option.

The Components And Controls Gallery dialog will appear. Double-click the Registered

ActiveX Control folder , and select Polar Draw control from the list.

Click Insert. Click OK when prompted “Insert this component?”. Click OK on the Confirm

Classes dialog to insert the Polar Draw classes in application. Click Close.

11. In the Workspace window, click the resources tab. Go to the view form dialog template. If you named your application “Draw”, the template name will be IDD_DRAW_FORM. You will find it under Draw resources – Dialogs - IDD_DRAW_FORM. Double-click the template’s name, and the dialog template will appear in the resource editor window.

12. Delete the default text label “TODO: Place form controls on this dialog.” from the template.

Click the Polar Draw control on the Controls palette and place the control on the template.

SUGGESTION: Make the control and the template as small as possible, because CformView class automatically adds scroll bars if the view window is smaller then the dialog template. Since Polar Draw ActiveX control provides its own scroll bars, you don’t need these scroll bars from the view. If you wish, you can now right-click on the control, select Properties… item from the menu, and adjust the behavior of the control.

13. Go to View | Class Wizard menu option, and in the MFC Class Wizard dialog click the Member Variables tab. In the Contro Ids list select IDC_POLARDRAWCTRL1 control ( this is the default name for the control , you may change it you wish.). Click the Add Variable… button. The Add Member Variable dialog will appear. In the Membe variable name edit box type the name for the variable that will represent the control (e.g. m_PolarDraw). Click OK.

14. Now, click the Message Maps tab in the Class Wizard dialog. Make sure that the view class is selected in the Class name list box (CDrawView, if the application name is “Draw”). In the Messages  list ,double-click the OnInitialUpdate and WM_SIZE items. Two member functions (OnInitialUpdate and OnSize) will be added to your view class. Now, edit these functions. They should look like this:

void CDrawView::OnInitialUpdate()

{

CFormView::OnInitialUpdate();

if (m_PolarDraw.GetSafeHwnd() != NULL)

{

CRect rc;

GetClientRect(&rc);

m_PolarDraw.MoveWindow(0, 0, rc.Width(), rc.Height());

m_PolarDraw.GetActiveWindow().FitTo(0);  // this will size the page to exactly fit the window at the startup

}

}

void CDrawView::OnSize(UINT nType, int cx, int cy)

{

CFormView::OnSize(nType, cx, cy);

if (m_PolarDraw.GetSafeHwnd() != NULL)

{

m_PolarDraw.MoveWindow(0,0,cx,cy);

}

}

THAT’S IT!

Of course, you have to add the code for your specific needs. For example, you could add the following lines to OnInitialUpdate function:

m_PolarDraw.SetEditMode( polCreateNew);

m_PolarDraw.SetCurrentShapeType( polRectangle);

This will make the control to create new shapes when a document is created. By default, the control is in the selection mode.

NOTE:

You must add the pdrawconst.h file to the application if you want to use the polCreateNew, polRectangle and other constants. You’ll find this file in the directory where you have installed the control. Otherwise, you have to use the exact numbers for these values.


Getting started in Borland Delphi

In order to insert Polar Draw ActiveX Control in your project, follow these steps:

1.	Install component on your system by starting its setup program.

2.	In Borland Delphi compiler IDE create new project or open existing one.

3.	In main menu choose "Component…" / "Import ActiveX control" option to start dialog.

4.	Find " POLAR Draw ActiveX control module " in dialog's list of available controls and select it.

5.	Click "Install…" button.

6.	In next dialog click "OK".

7.	In next dialog click "OK" to rebuild package.

8.	After the package is built, you have to close two more dialogs by clicking "OK".

9.	Now you can see icon [image] on a Component Palette in ActiveX components tab, representing chosen control.

10.	You can use control just like any other Windows control, e.g. you can:

1. Draw control in dialog resource as a child control, or

2. Manually add member object in your dialog form.


Getting started in Borland C++ Builder

In order to insert Polar Draw ActiveX Control in your project, follow these steps:

1.	Install component on your system by starting its setup program.

2.	In Borland Builder compiler IDE create new project or open existing one.

3.	In main menu choose "Component…" / "Import ActiveX control" option to start dialog.

4.	Find " POLAR Draw ActiveX control module " in dialog's list of available controls and select it.

5.	Click "Install…" button.

6.	In next dialog click "OK".

7.	In next dialog click "Yes" to rebuild package.

8.	After the package is built, you have to close one more dialog by clicking "OK".

9.	Now you can see icon [image] on a Component Palette in ActiveX components tab, representing chosen control.

10.	You can use control just like any other Windows control, e.g. you can:

1. Draw control in dialog resource as a child control,	or

2. Manually add member object in your dialog form.