当前位置: 首页>>代码示例>>C#>>正文


C# Shape.SetValue方法代码示例

本文整理汇总了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);
 }
开发者ID:mandrek44,项目名称:BloodSimu,代码行数:7,代码来源:MainWindow.xaml.cs

示例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;
        }
开发者ID:zbxzc35,项目名称:Classifier,代码行数:12,代码来源:WindowCanvas.cs

示例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;
 }
开发者ID:Porokhnin,项目名称:Replication,代码行数:7,代码来源:DrawingView.xaml.cs

示例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;
        }
开发者ID:pomma89,项目名称:Dessert.MazeEscape,代码行数:15,代码来源:MazeCanvas.xaml.cs

示例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;
            }
        }
开发者ID:aleksanderkobylak,项目名称:oxyplot,代码行数:63,代码来源:ShapesRenderContext.cs

示例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);
 }
开发者ID:NaturalWill,项目名称:FindingStar,代码行数:10,代码来源:MainWindow.xaml.cs


注:本文中的System.Windows.Shapes.Shape.SetValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。