DrawSurface Property

Structured Graphics Control

Sets or retrieves the drawing surface, the visible rendering of the control's contents for use in script.

Syntax

ScriptingSGObj.DrawSurface

The Microsoft® DirectAnimation® DADrawingSurface object uses a style of drawing that depends on a graphics context. A DADrawingSurface object maintains a graphics-state object for two-dimensional graphics. This state includes attributes such as line style, fill style, border style, font style, and two-dimensional transformations.

To use the DADrawingSurface from the Structured Graphics control, first set up the DirectAnimation Library and a DADrawingSurface container for the Structured Graphics control. After you have the DADrawingSurface object, you can use its functions and subroutines.

The following VBScript shows how to create and use a Structured Graphics DADrawingSurface object, ds.

<OBJECT ID=SGControl
STYLE="Position:absolute; WIDTH:400; HEIGHT:400; top:10; left:10;
Z-INDEX:–1"  
CLASSID="CLSID:369303C2-D7AC-11d0-89D5-00A0C90833E6">
</OBJECT>

<SCRIPT LANGUAGE="VBScript">

dim ds

Set lib=SGControl.Library    ' Sets the DirectAnimation Library
                             ' for DADrawingSurface operations.
							 
Set ds=SGControl.DrawSurface ' Sets the container "ds" as the
                             ' SGControl's DADrawingSurface
                             ' property container.
							 
call ds.fillcolor(lib.blue)  ' Sets the color for the square.

call ds.rect(-50,-50,200,200)' Draws the square.

SGControl.DrawSurface=ds     ' Returns the shape you have
                             ' constructed to the SGControl
                             ' for painting to the screen.
</SCRIPT>

For more information, see the DADrawingSurface class and the Drawing Surface topic in the DirectAnimation Programmer's Guide.

Example

Right-click inside the frame and choose View Source to see the HTML code for this example.


Top of Page Top of Page
© 2000 Microsoft and/or its suppliers. All rights reserved. Terms of Use.