本文整理汇总了C#中System.Windows.Media.TransformGroup.Freeze方法的典型用法代码示例。如果您正苦于以下问题:C# TransformGroup.Freeze方法的具体用法?C# TransformGroup.Freeze怎么用?C# TransformGroup.Freeze使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.TransformGroup
的用法示例。
在下文中一共展示了TransformGroup.Freeze方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitializeTransform
/// <summary> </summary>
public override void InitializeTransform()
{
double mercatorSize = 360;
TranslateTransform translateTransform = new TranslateTransform(MapView.ReferenceSize / 2 - 180, MapView.ReferenceSize / 2 - 180);
ScaleTransform zoomTransform = new ScaleTransform(MapView.ZoomAdjust * MapView.ReferenceSize / mercatorSize, MapView.ZoomAdjust * MapView.ReferenceSize / mercatorSize, MapView.ReferenceSize / 2, MapView.ReferenceSize / 2);
TransformGroup transformGroup = new TransformGroup();
transformGroup.Children.Add(translateTransform);
transformGroup.Children.Add(zoomTransform);
zoomTransform.Freeze();
translateTransform.Freeze();
transformGroup.Freeze();
this.RenderTransform = transformGroup;
}
示例2: CreateNormalizeTransform
static Transform CreateNormalizeTransform(Rect bounds, Point location, Size size, double angle)
{
if (bounds.IsEmpty)
return Transform.Identity;
var t = new TransformGroup();
var b = bounds;
// Move center of the geometry to origin
t.Children.Add(new TranslateTransform(-b.X - b.Width / 2, -b.Y - b.Height / 2));
// Rotate around origin
t.Children.Add(new RotateTransform(angle));
b = t.TransformBounds(bounds);
// Scale to requested size
t.Children.Add(new ScaleTransform(size.Width / b.Width, size.Height / b.Height));
b = t.TransformBounds(bounds);
// Move to requested position
t.Children.Add(new TranslateTransform(-b.X + location.X, -b.Y + location.Y));
t.Freeze();
b = t.TransformBounds(bounds);
Debug.Assert(Math.Abs(b.X - location.X) < 0.0001);
Debug.Assert(Math.Abs(b.Y - location.Y) < 0.0001);
Debug.Assert(Math.Abs(b.Width - size.Width) < 0.0001);
Debug.Assert(Math.Abs(b.Height - size.Height) < 0.0001);
return t;
}