本文整理汇总了C#中System.Windows.Media.Transform类的典型用法代码示例。如果您正苦于以下问题:C# Transform类的具体用法?C# Transform怎么用?C# Transform使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Transform类属于System.Windows.Media命名空间,在下文中一共展示了Transform类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TransformedBitmap
/// <summary>
/// Construct a TransformedBitmap with the given newTransform
/// </summary>
/// <param name="source">BitmapSource to apply to the newTransform to</param>
/// <param name="newTransform">Transform to apply to the bitmap</param>
public TransformedBitmap(BitmapSource source, Transform newTransform)
: base(true) // Use base class virtuals
{
if (source == null)
{
throw new ArgumentNullException("source");
}
if (newTransform == null)
{
throw new InvalidOperationException(SR.Get(SRID.Image_NoArgument, "Transform"));
}
if (!CheckTransform(newTransform))
{
throw new InvalidOperationException(SR.Get(SRID.Image_OnlyOrthogonal));
}
_bitmapInit.BeginInit();
Source = source;
Transform = newTransform;
_bitmapInit.EndInit();
FinalizeCreation();
}
示例2: EllipseGeometry
public EllipseGeometry (Point center, double radiusX, double radiusY, Transform transform)
{
Transform = transform;
Center = center;
RadiusX = radiusX;
RadiusY = radiusY;
}
示例3: OnMouseMove
protected override void OnMouseMove(MouseEventArgs e)
{
Window wnd = Window.GetWindow(this);
Point currentLocation = e.MouseDevice.GetPosition(wnd);
var move = new TranslateTransform(
currentLocation.X - _previousLocation.X, currentLocation.Y - _previousLocation.Y);
if (e.LeftButton == MouseButtonState.Pressed)
{
var group = new TransformGroup();
if (_previousTransform != null)
{
group.Children.Add(_previousTransform);
}
group.Children.Add(move);
RenderTransform = group;
}
else
{
Cursor = Cursors.Hand;
}
_previousLocation = currentLocation;
_previousTransform = RenderTransform;
MainWindow.Instance.CalculatePositions();
base.OnMouseMove(e);
}
示例4: LineGeometry
/// <summary>
///
/// </summary>
public LineGeometry(
Point startPoint,
Point endPoint,
Transform transform) : this(startPoint, endPoint)
{
Transform = transform;
}
示例5: AdornerChartMarkers
public AdornerChartMarkers(UIElement adornedElement, Transform shapeTransform, IList<ChartMarkerSet> markerSets, XYLineChart parentChart) : base(adornedElement)
{
_adornedElement = adornedElement;
_parentChart = parentChart;
_markerSets = markerSets;
_transform = shapeTransform;
}
示例6: GetTransformedFigureCollection
internal override PathFigureCollection GetTransformedFigureCollection(Transform transform)
{
// Combine the transform argument with the internal transform
Transform combined = new MatrixTransform(GetCombinedMatrix(transform));
PathFigureCollection result = new PathFigureCollection();
GeometryCollection children = Children;
if (children != null)
{
for (int i = 0; i < children.Count; i++)
{
PathFigureCollection pathFigures = children.Internal_GetItem(i).GetTransformedFigureCollection(combined);
if (pathFigures != null)
{
int count = pathFigures.Count;
for (int j = 0; j < count; ++j)
{
result.Add(pathFigures[j]);
}
}
}
}
return result;
}
示例7: RectangleGeometry
public RectangleGeometry (Rect rect, double radiusX, double radiusY, Transform transform)
{
Transform = transform;
Rect = rect;
RadiusX = radiusX;
RadiusY = radiusY;
}
示例8: EllipseGeometry
/// <summary>
/// Constructor - sets the ellipse to the parameters
/// </summary>
public EllipseGeometry(
Point center,
double radiusX,
double radiusY,
Transform transform) : this(center, radiusX, radiusY)
{
Transform = transform;
}
示例9: RectangleGeometry
/// <summary>
///
/// </summary>
/// <param name="rect"></param>
/// <param name="radiusX"></param>
/// <param name="radiusY"></param>
/// <param name="transform"></param>
public RectangleGeometry(
Rect rect,
double radiusX,
double radiusY,
Transform transform) : this(rect, radiusX, radiusY)
{
Transform = transform;
}
示例10: GetTransformedGeometries
public static IEnumerable<Geometry> GetTransformedGeometries(IEnumerable<SqlGeometry> collection, Transform transform)
{
foreach (var item in collection)
{
Geometry wpf = item.ToWpfGeometry();
wpf.Transform = transform;
yield return wpf;
}
}
示例11: LayoutTransformerScenario
/// <summary>
/// Initializes a new instance of the LayoutTransformerScenario class.
/// </summary>
/// <param name="preferredWidth">Preferred width of the test control.</param>
/// <param name="preferredHeight">Preferred height of the test control.</param>
/// <param name="measureAtPreferredSize">Whether the child control should force its preferred size during Measure.</param>
/// <param name="arrangeAtPreferredSize">Whether the child control should force its preferred size during Arrange.</param>
/// <param name="measureWidth">Width to pass to Measure.</param>
/// <param name="measureHeight">Height to pass to Measure.</param>
/// <param name="desiredWidth">Expected DesiredSize.Width.</param>
/// <param name="desiredHeight">Expected DesiredSize.Height.</param>
/// <param name="arrangeWidth">Width to pass to Arrange.</param>
/// <param name="arrangeHeight">Height to pass to Arrange.</param>
/// <param name="renderWidth">Expected RenderSize.Width.</param>
/// <param name="renderHeight">Expected RenderSize.Height.</param>
/// <param name="transform">Transform to use.</param>
public LayoutTransformerScenario(double preferredWidth, double preferredHeight, bool measureAtPreferredSize, bool arrangeAtPreferredSize, double measureWidth, double measureHeight, double desiredWidth, double desiredHeight, double arrangeWidth, double arrangeHeight, double renderWidth, double renderHeight, Transform transform)
{
PreferredSize = new Size(preferredWidth, preferredHeight);
_measureAtPreferredSize = measureAtPreferredSize;
_arrangeAtPreferredSize = arrangeAtPreferredSize;
MeasureSize = new Size(measureWidth, measureHeight);
DesiredSize = new Size(desiredWidth, desiredHeight);
ArrangeSize = new Size(arrangeWidth, arrangeHeight);
RenderSize = new Size(renderWidth, renderHeight);
Transform = transform;
}
示例12: RenderUnfilledElements
public void RenderUnfilledElements(DrawingContext ctx, Rect chartArea, Transform transform) {
CalculateGeometry(chartArea);
if(LineColor != Colors.Transparent && LineThickness > 0) {
Pen pen = new Pen(new SolidColorBrush(LineColor), LineThickness);
pen.LineJoin = PenLineJoin.Bevel;
if(IsDashed) {
pen.DashStyle = new DashStyle(new double[] { 2, 2 }, 0);
}
_unfilledGeometry.Transform = transform;
ctx.DrawGeometry(null, pen, _unfilledGeometry);
}
}
示例13: StartAnimation
public static void StartAnimation (Transform animatableElement, DependencyProperty dependencyProperty, double toValue, double durationMilliseconds, double accelerationRatio, double decelerationRatio)
{
DoubleAnimation animation = new DoubleAnimation();
animation.To = toValue;
animation.AccelerationRatio = accelerationRatio;
animation.DecelerationRatio = decelerationRatio;
animation.FillBehavior = FillBehavior.HoldEnd;
animation.Duration = TimeSpan.FromMilliseconds(durationMilliseconds);
animation.Freeze();
animatableElement.BeginAnimation(dependencyProperty, animation, HandoffBehavior.Compose);
}
示例14: DoubleAnimator
/// <summary>
/// Initializes a new instance of the <see cref="DoubleAnimator"/> class.
/// </summary>
/// <param name="translateTransform">The translate transform.</param>
/// <param name="property">The property.</param>
public DoubleAnimator(Transform transform, string property)
{
this.transform = transform;
this.storyboard.Completed += this.OnCompleted;
this.storyboard.Children.Add(this.animation);
Storyboard.SetTarget(this.animation, this.transform);
#if WINDOWS_PHONE
Storyboard.SetTargetProperty(this.animation, new PropertyPath(property));
#else
Storyboard.SetTargetProperty(this.animation, property);
#endif
}
示例15: RenderUnfilledElements
public void RenderUnfilledElements(DrawingContext ctx, Rect chartArea, Transform transform) {
for(int segmentIndex = 0; segmentIndex < _lineColors.Count; ++segmentIndex) {
SolidColorBrush brush = new SolidColorBrush(_lineColors[segmentIndex]);
Pen pen = new Pen(brush, LineThickness);
pen.LineJoin = PenLineJoin.Bevel;
if(IsDashed) {
pen.DashStyle = new DashStyle(new double[] { 2, 2 }, 0);
}
ctx.DrawLine(pen, transform.Transform(Points[segmentIndex*2]), transform.Transform(Points[segmentIndex*2+1]));
}
}