本文整理汇总了C#中System.Windows.Shapes.Shape.SetValue方法的典型用法代码示例。如果您正苦于以下问题:C# Shape.SetValue方法的具体用法?C# Shape.SetValue怎么用?C# Shape.SetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Shapes.Shape
的用法示例。
在下文中一共展示了Shape.SetValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdatePosition
private void UpdatePosition(Shape ellipse, Particle particle)
{
if (particle.IsStopped())
ellipse.Fill = _cholesterolBrush;
ellipse.SetValue(Canvas.LeftProperty, particle.Position.X - _particleSize /2);
ellipse.SetValue(Canvas.TopProperty, particle.Position.Y - _particleSize / 2);
}
示例2: InitializeShape
internal static Shape InitializeShape(this Canvas canvas, Rectangle rect, Shape shape, double scaleX, double scaleY, Brush color)
{
shape.SetValue(WindowData.RectLeftProperty, rect.X * scaleX);
shape.SetValue(WindowData.RectTopProperty, rect.Y * scaleY);
shape.Width = rect.W * scaleX;
shape.Height = rect.H * scaleY;
shape.Stroke = color;
shape.StrokeThickness = 2;
return shape;
}
示例3: SetShapeSize
private void SetShapeSize(Shape shape, Abstraction.Rectangle rectangle)
{
shape.SetValue(Canvas.LeftProperty, rectangle.X);
shape.SetValue(Canvas.TopProperty, rectangle.Y);
shape.Width = rectangle.Width;
shape.Height = rectangle.Height;
}
示例4: PositionEscaperInsideCell
void PositionEscaperInsideCell(Shape figure, Cell cell)
{
// Cell dimensions are computed from canvas size.
var cellWidth = Canvas.ActualWidth / _currentMaze.Width;
var cellHeight = Canvas.ActualHeight / _currentMaze.Height;
// Useful methods to compute cell offsets.
Func<uint, double> xOffset = x => x * cellWidth;
Func<uint, double> yOffset = y => y * cellHeight;
figure.Fill = new SolidColorBrush(Colors.Magenta);
figure.SetValue(Canvas.LeftProperty, xOffset(cell.X));
figure.SetValue(Canvas.TopProperty, yOffset(cell.Y));
figure.Width = figure.Height = 15;
}
示例5: SetStroke
/// <summary>
/// The set stroke.
/// </summary>
/// <param name="shape">
/// The shape.
/// </param>
/// <param name="stroke">
/// The stroke.
/// </param>
/// <param name="thickness">
/// The thickness.
/// </param>
/// <param name="lineJoin">
/// The line join.
/// </param>
/// <param name="dashArray">
/// The dash array.
/// </param>
/// <param name="aliased">
/// The aliased.
/// </param>
private void SetStroke(
Shape shape,
OxyColor stroke,
double thickness,
OxyPenLineJoin lineJoin = OxyPenLineJoin.Miter,
IEnumerable<double> dashArray = null,
bool aliased = false)
{
if (stroke != null && thickness > 0)
{
shape.Stroke = this.GetCachedBrush(stroke);
switch (lineJoin)
{
case OxyPenLineJoin.Round:
shape.StrokeLineJoin = PenLineJoin.Round;
break;
case OxyPenLineJoin.Bevel:
shape.StrokeLineJoin = PenLineJoin.Bevel;
break;
// The default StrokeLineJoin is Miter
}
if (Math.Abs(thickness - 1) > double.Epsilon)
{
// only set if different from the default value (1)
shape.StrokeThickness = thickness;
}
if (dashArray != null)
{
shape.StrokeDashArray = new DoubleCollection(dashArray);
}
}
if (aliased)
{
shape.SetValue(RenderOptions.EdgeModeProperty, EdgeMode.Aliased);
shape.SnapsToDevicePixels = true;
}
}
示例6: MoveToPoint
/// <summary>
/// Set the position in grid
/// </summary>
/// <param name="p"></param>
/// <param name="s"></param>
private static void MoveToPoint(System.Drawing.Point p, Shape s)
{
s.SetValue(Grid.ColumnProperty, p.X);
s.SetValue(Grid.RowProperty, p.Y);
}