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


C# DrawingAttributes.GetPropertyData方法代码示例

本文整理汇总了C#中System.Windows.Ink.DrawingAttributes.GetPropertyData方法的典型用法代码示例。如果您正苦于以下问题:C# DrawingAttributes.GetPropertyData方法的具体用法?C# DrawingAttributes.GetPropertyData怎么用?C# DrawingAttributes.GetPropertyData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Ink.DrawingAttributes的用法示例。


在下文中一共展示了DrawingAttributes.GetPropertyData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DrawCore

        protected override void DrawCore(DrawingContext drawingContext, DrawingAttributes drawingAttributes)
        {
            if (drawingContext == null)
            {
                throw new ArgumentNullException("drawingContext");
            }
            if (null == drawingAttributes)
            {
                throw new ArgumentNullException("drawingAttributes");
            }
            Pen pen = new Pen
            {
                StartLineCap = PenLineCap.Round,
                EndLineCap = PenLineCap.Round,
                Brush = new SolidColorBrush(drawingAttributes.Color),
                Thickness = drawingAttributes.Width
            };

            BrushConverter bc = new BrushConverter();
            Brush BackGround = (Brush)bc.ConvertFromString(drawingAttributes.GetPropertyData(DrawAttributesGuid.BackgroundColor).ToString());
            GeometryConverter gc = new GeometryConverter();
            Geometry geometry = (Geometry)gc.ConvertFromString(string.Format("M {0},{1} {2},{3} {4},{5} Z", StylusPoints[0].X, StylusPoints[1].Y, (Math.Abs(StylusPoints[1].X - StylusPoints[0].X))/2 + StylusPoints[0].X, StylusPoints[0].Y, StylusPoints[1].X, StylusPoints[1].Y));
            GeometryDrawing gd = new GeometryDrawing(BackGround, pen, geometry);
            drawingContext.DrawDrawing(gd);
        }
开发者ID:sonicrang,项目名称:RangPaint,代码行数:25,代码来源:TriangleStroke.cs

示例2: DrawCore

        protected override void DrawCore(DrawingContext drawingContext, DrawingAttributes drawingAttributes)
        {
            if (drawingContext == null)
            {
                throw new ArgumentNullException("drawingContext");
            }
            if (null == drawingAttributes)
            {
                throw new ArgumentNullException("drawingAttributes");
            }
            Pen pen = new Pen
            {
                StartLineCap = PenLineCap.Round,
                EndLineCap = PenLineCap.Round,
                Brush = new SolidColorBrush(drawingAttributes.Color),
                Thickness = drawingAttributes.Width
            };

            BrushConverter bc = new BrushConverter();
            Brush BackGround = (Brush)bc.ConvertFromString(drawingAttributes.GetPropertyData(DrawAttributesGuid.BackgroundColor).ToString());

            drawingContext.DrawRectangle(
                BackGround,
                pen,
                new Rect(new Point(StylusPoints[0].X, StylusPoints[0].Y),
                    new Point(StylusPoints[1].X, StylusPoints[1].Y)));
        }
开发者ID:sonicrang,项目名称:RangPaint,代码行数:27,代码来源:RectangleStroke.cs

示例3: DrawCore

        protected override void DrawCore(DrawingContext drawingContext, DrawingAttributes drawingAttributes)
        {
            if (drawingContext == null)
            {
                throw new ArgumentNullException("drawingContext");
            }
            if (null == drawingAttributes)
            {
                throw new ArgumentNullException("drawingAttributes");
            }
            Pen pen = new Pen
            {
                StartLineCap = PenLineCap.Round,
                EndLineCap = PenLineCap.Round,
                Brush = new SolidColorBrush(drawingAttributes.Color),
                Thickness = drawingAttributes.Width
            };
            Rect r = new Rect(
                new Point(StylusPoints[0].X, StylusPoints[0].Y),
                new Point(StylusPoints[1].X, StylusPoints[1].Y));

            Point center = new Point(
                 (r.Left + r.Right) / 2.0,
                 (r.Top + r.Bottom) / 2.0);

            double radiusX = (r.Right - r.Left) / 2.0;
            double radiusY = (r.Bottom - r.Top) / 2.0;

            BrushConverter bc = new BrushConverter();
            Brush BackGround = (Brush)bc.ConvertFromString(drawingAttributes.GetPropertyData(DrawAttributesGuid.BackgroundColor).ToString());

            drawingContext.DrawEllipse(
                BackGround,
                pen,
                center,
                radiusX,
                radiusY);
        }
开发者ID:sonicrang,项目名称:RangPaint,代码行数:38,代码来源:EllipseStroke.cs

示例4: PersistDrawingFlags

        private static void PersistDrawingFlags(DrawingAttributes da, Stream stream, GuidList guidList, ref uint cbData, ref BinaryWriter bw)
        { 
            //
            // always serialize DrawingFlags, even when it is the default of AntiAliased.  V1 loaders
            // expect it.
            // 
            Debug.Assert(bw != null);
            cbData += SerializationHelper.Encode(stream, (uint)guidList.FindTag(KnownIds.DrawingFlags, true)); 
            cbData += SerializationHelper.Encode(stream, (uint)(int)da.DrawingFlags); 

            if (da.ContainsPropertyData(KnownIds.CurveFittingError)) 
            {
                Debug.Assert(bw != null);
                cbData += SerializationHelper.Encode(stream, (uint)guidList.FindTag(KnownIds.CurveFittingError, true));
                cbData += SerializationHelper.Encode(stream, (uint)(int)da.GetPropertyData(KnownIds.CurveFittingError)); 
            }
        } 
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:17,代码来源:DrawingAttributeSerializer.cs


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