I have a polygon, I rotate it 90 degrees, it shows up fine on the GUI, however the ActualHeight and ActualWidth are still the same as before. I have tried RenderTransform and LayoutTransform, but neither makes a difference.
How can I make it so the polygon's height and width get updated after the transform?
The following is in the constructor under InitializeComponent();
-------------------------------------------------
Polygon _currShape = new Polygon();
_currShape.Fill = System.Windows.Media.Brushes.Blue;
System.Windows.Media.PointCollection pointCollection = new System.Windows.Media.PointCollection();
pointCollection.Add(new Point(23, 0));
pointCollection.Add(new Point(115, 0));
pointCollection.Add(new Point(115, 23));
pointCollection.Add(new Point(23, 23));
_currShape.Points = pointCollection;
TetrisCanvas.Children.Add(_currShape);
Canvas.SetLeft(_currShape, 100);
Canvas.SetTop(_currShape, 100);
RotateTransform rt = new RotateTransform(90);
_currShape.RenderTransform = rt;
Loading

Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Jul 12, 2011, 1:58 AM EDT
Anyway, if you need to get the height and width of the rotated polygon with 90' then you can take the updated height as width and updated width as height.
like,
double updatedHeight =_currShape.Width;
double updatedWidth = _currShape.Height;
Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Jul 11, 2011, 2:53 AM EDT
Can you post the bit of code..
Sam HobbsRank #107 · 20.5K reputationPosted Jul 11, 2011, 4:50 PM EDT
David Kay12 reputationPosted Jul 11, 2011, 10:30 PM EDT
Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Jul 12, 2011, 1:45 AM EDT
You are changing the angle of the polygon right. then how will the height and width change.? i cant get you...
David Kay12 reputationPosted Jul 12, 2011, 1:49 AM EDT
David Kay12 reputationPosted Jul 12, 2011, 2:03 AM EDT
Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Jul 12, 2011, 2:19 AM EDT
Dea SaddlerRank #289 · 8.7K reputationPosted Jul 12, 2011, 2:25 AM EDT
You can take help from The below blog.
http://www.vbdotnetheaven.com/Blogs/5395/how-to-rotate-a-ployline-in-wpf.aspx
Which contains rotation of polyline, so you can also rotate polygon with this method.