Shape is the most basic object of VML. You can use it to draw all the graphics you want. In VML, the coordinates used are not the coordinates of the Document. It has its own coordinate system. In this way, by dynamically changing its coordinates, functions such as zooming in, zooming out, and rotating can be achieved. The CoordSize attribute of shape is used to define coordinates. It has two parameters,
Note: The coordinates defined by are only relative. The actual displayed graphic size also needs to be defined with style="width:500;height:500"!
After the above definition, the coordinates available to you are x(-1400 to 1400) y(-1400 to 1400). Such coordinates are like coordinates in mathematics, dividing the drawing board into four blocks .
When solving actual problems, I found that IE will automatically Putting the visible VML image at the relative (0,0) position means that if the above two pictures do not add two auxiliary coordinates, they will be displayed as two squares side by side on IE.
The most important attribute in shape is Path, which is a powerful brush. The syntax is very simple and consists of a few letters. It is described in detail below:
m x, y: MoveTo moves the brush to (x, y);
l x,y: LineTo draws a line from the current point to (x, y); you can give several consecutive points, and VML will draw them continuously until they meet x command.
x:Close to end a line;
e:End to end the drawing
Other common attributes of shape:
FillColor: fill color, use the color specified in HTML; for example: fillcolor=red
Filled: whether to fill the graphic, if the graphic is not closed, the graphic will be automatically closed for filling . When Filled="true" (default), fillcolor has an effect;
StrokeColor: the color of the line;
StrokeWeight: the width of the line;
Title: When the mouse moves over the graphic, the text displayed is the same as alt and tilt in HTML;
Type: Specifies which ShapeType the graphic belongs to, and the ShapeType can be The VML formulation template will be described later;
For these previous attributes, FillColor and Filled can be used in
In the following sections, some specific objects extended by Shape will be introduced in detail, such as Rect, RoundRect, Oval, Line and other objects.