Click here to Skip to main content
15,867,453 members
Articles / Programming Languages / C#
Article

Rotation transformer example

Rate me:
Please Sign up or sign in to vote.
1.78/5 (10 votes)
3 Jan 20042 min read 46.1K   511   11  
Example of Rotation transformer in Longhorn.

Introduction

Longhorn is code name of next Microsoft Windows major release. This version of OS is more technology driven. In each version, Microsoft comes with new GUI idea. E.g., XP with new look and feel with clear type font technology. Longhorn will include GUI based on SVG instead of Bitmapped (GDI+). SVG is more faster to generate cool graphics effects without effecting CPU performance.

Microsoft released LongHorn PDC version in 2003. This is alpha version, so it includes much much less then targeted in final release. This OS final version is expected in 2006 but there are so many information available to begin and gain knowledge before the OS hits the software industry.

Keep watch on the following sites to get knowledge:

Microsoft is not working only on OS but also working on the next generation IDE code name Whidbey and new SDK.

Transform Decorator

In Avalon API, Microsoft included TransformDecorator. Avalon is code name for next generation GUI API and Aero is next generation OS GUI. TransformDecorator is a component container that allows to add special effects to child components with out affecting or changing component's basic functionality.

So, before adding any component directly in WinForm or canvas, first you can add component to TransformDecorator and then add that TransformDecorator to WinForm or canvas, and attach transformer to that TransformDecorator.

Rotate Transform

RotateTransform adds rotation effect to child component. It accepts angle as input and rotates component by that angle. See below:

Sample screenshot

Sample screenshot

Adding Component in Transform Decorator

C#
// Create a canvas sized to fill the window
canvasLeft = new Canvas ();
canvasLeft.Background = MSAvalon.Windows.Media.Brushes.BlueViolet;
mainWindow.Children.Add(canvasLeft);
canvasLeft.Width = new Length(80f, UnitType.Percent);
canvasLeft.Height = new Length(100f, UnitType.Percent);
//List Box
lstBox = new ListBox();
transformer = new TransformDecorator();
transformer.Width = new Length(90f, UnitType.Percent);
transformer.Height = new Length(90f, UnitType.Percent);
Canvas.SetLeft(transformer, new Length(5f, UnitType.Percent));
Canvas.SetTop(transformer, new Length(5f, UnitType.Percent));
RotateTransform myRotateTransform = new RotateTransform(160);
transformer.Transform = myRotateTransform;
transformer.Child = lstBox;
canvasLeft.Children.Add(transformer);

Changing Angle

C#
public void comboBox_SelectionChanged(object sender, 
          SelectionChangedEventArgs args)
{
  RotateTransform myRotateTransform = 
    new RotateTransform(System.Convert.ToDouble(args.SelectedItems[0]));
  transformer.Transform = myRotateTransform;
}

Note

This demo will only work on PDC version of Longhorn OS.

Finally...

This is only one example of cool effect in LongHorn, there are many other cool effects. See demo of same effect here.

Enjoy!!!

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
United States United States
Senior Software Er.
Aspect Communication
San Jose USA CA


Comments and Discussions

 
-- There are no messages in this forum --