You can set the rendertransform attribute of the Graphic Element in either of the following ways:

Source: Internet
Author: User
The rendertransform attribute allows you to use a transform object to rotate, tilt, scale, and offset an element. There are several different transform objects:
    • Rotatetransform: rotate the object at the specified angle.
    • Skewtransform: skew the object.
    • Scaletransform: scales up or down an object.
    • Translatetransform: offset the object from the original coordinate.

In addition, there is a special type of transform object: transformgroup. You can use it to perform more operations on an object application.

The following is an example in the SDK,CodeAs follows:

 

< Canvas Width = "300" Height = "300"
Xmlns = "Http://schemas.microsoft.com/client/2007"
Xmlns: x = "Http://schemas.microsoft.com/winfx/2006/xaml"
>
< Rectangle Height = "100" Width = "100" Canvas. Left = "70" Canvas. Top = "10"
Fill = "Black" >
< Rectangle. rendertransform >
< Rotatetransform Angle = "45" />
</ Rectangle. rendertransform >
</ Rectangle >

< Rectangle Height = "100" Width = "100" Canvas. Left = "130" Canvas. Top = "10"
Fill = "Red" >
< Rectangle. rendertransform >
< Skewtransform Anglex = "30" />
</ Rectangle. rendertransform >
</ Rectangle >

< Rectangle Height = "100" Width = "100" Canvas. Left = "10" Canvas. Top = "190"
Fill = "Blue" >
< Rectangle. rendertransform >
< Scaletransform Scalex = "1.3" Scaley = ". 5" />
</ Rectangle. rendertransform >
</ Rectangle >

< Rectangle Height = "100" Width = "100" Canvas. Left = "160" Canvas. Top = "130"
Fill = "Green" >
< Rectangle. rendertransform >
< Transformgroup >
< Rotatetransform Angle = "45" />
< Scaletransform Scalex = ". 5" Scaley = "1.2" />
< Skewtransform Anglex = "30" />
</ Transformgroup >
</ Rectangle. rendertransform >
</ Rectangle >
</Canvas> 

As shown in: This is directly set in XAML. In fact, you can also set it using JS functions. The following is a simple sample code:

 

 VaRStransformg = '<transformgroup/> ';

VaROtransformg = ohost. createfromxaml (stransformg );

VaRStransformcollection = '<transformcollection/> ';
VaROtransformcollection = ohost. createfromxaml (stransformcollection );

VaRSrotatetransform = '<rotatetransform/> ';
VaROrotatetransform = ohost. createfromxaml (srotatetransform );
Orotatetransform. angle = 50;

Otransformcollection. Add (orotatetransform );

VaRSscaletransform = '<scaletransform/> ';
VaROscaletransform = ohost. createfromxaml (sscaletransform );
Oscaletransform. scalex = 5;
Oscaletransform. scaley = 5;

Otransformcollection. Add (oscaletransform );

otransformg. Children = otransformcollection;
oobject. rendertransform = otransformg;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.