本文整理汇总了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);
}
示例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)));
}
示例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);
}
示例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));
}
}