Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - Rotate Control in C#

 
 
Old 05-31-2006   #1 (permalink)
MyWebTV


 
 

Rotate Control in C#

I like to rotate a image control by using animation and control in coding. I
am using DoubleAnimation and set from and to for the rotation. I have trouble
to set DepedencyProperty for the rotation. Is any one show me how to set it
in C# code ?

Thanks

My System SpecsSystem Spec
Old 05-31-2006   #2 (permalink)
Vipin [MVP]


 
 

Re: Rotate Control in C#

Shouldn't you be using MatrixAnimation?

--
Vipin Aravind
http://www.explorewindows.com


"MyWebTV" <MyWebTV@discussions.microsoft.com> wrote in message
news:E3B1D437-F8B7-46FB-82AA-6FE04A310D27@microsoft.com...
>I like to rotate a image control by using animation and control in coding.
>I
> am using DoubleAnimation and set from and to for the rotation. I have
> trouble
> to set DepedencyProperty for the rotation. Is any one show me how to set
> it
> in C# code ?
>
> Thanks



My System SpecsSystem Spec
Old 06-02-2006   #3 (permalink)
Andrew C


 
 

RE: Rotate Control in C#

Here is a simple way of doing a rotation animation on an image without using
matrices.

Code:
//Create new image object
Image myImage = new Image();
//Create a rotation transform
RotateTransform rotateTransform = new RotateTransform(0);
//Apply the transform to the image
myImage.RenderTransform = rotateTransform;
//Create a new double animation
DoubleAnimation doubleAnimation = new DoubleAnimation();
doubleAnimation.From = 0; //Set From value
doubleAnimation.To = 180; //Set To Value
doubleAnimation.Duration = 10; //Time it takes to do the animation
//After the animation is complete hold the last value
doubleAnimation.FillBehavior = FillBehavior.HoldEnd;

//Begin the animation on the rotation animation
rotateTransform.BeginAnimation(RotateTransform.AngleProperty,
doubleAnimation);



In your case I don't think you need to resort to using MatrixAnimations.

Hope this helps,
Andrew C


"MyWebTV" wrote:

> I like to rotate a image control by using animation and control in coding. I
> am using DoubleAnimation and set from and to for the rotation. I have trouble
> to set DepedencyProperty for the rotation. Is any one show me how to set it
> in C# code ?
>
> Thanks

My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
Rotate video clip Vista music pictures video
Rotate picture by degrees Vista music pictures video


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46