David Kay

David Kay

  • NA
  • 12
  • 7k

Polygon Rotation Problem

Jul 11 2011 4:39 AM
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;

Answers (9)