本文整理汇总了C#中System.Windows.Ink.DrawingAttributes.RemovePropertyData方法的典型用法代码示例。如果您正苦于以下问题:C# DrawingAttributes.RemovePropertyData方法的具体用法?C# DrawingAttributes.RemovePropertyData怎么用?C# DrawingAttributes.RemovePropertyData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Ink.DrawingAttributes
的用法示例。
在下文中一共展示了DrawingAttributes.RemovePropertyData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DecodeAsISF
//.........这里部分代码省略.........
//Since StylusTip is stored in the EPC at this point (if set), we can compare against it here.
if (da.StylusTip != StylusTip.Ellipse)
{
//
// StylusTip was set to something other than Ellipse
// when we last serialized (or else StylusTip would be Ellipse, the default)
// when StylusTip is != Ellipse and we serialize, we set PenTip to Rectangle
// which is not the default. Therefore, if PenTip is back to Circle,
// that means someone set it in V1 and we should respect that by
// changing StylusTip back to Ellipse
//
da.StylusTip = StylusTip.Ellipse;
}
//else da.StylusTip is already set
}
else
{
System.Diagnostics.Debug.Assert(penTip == PenTip.Rectangle);
if (da.StylusTip == StylusTip.Ellipse)
{
//
// PenTip is Rectangle and StylusTip was either not set
// before or was set to Ellipse and PenTip was changed
// in a V1 ink object. Either way, we need to change StylusTip to Rectangle
da.StylusTip = StylusTip.Rectangle;
}
//else da.StylusTip is already set
}
//
// 2) next we need to set hight and width
//
if (da.StylusTip == StylusTip.Ellipse &&
widthIsSetInISF &&
!heightIsSetInISF)
{
//
// special case: V1 PenTip of Circle only used Width to compute the circle size
// and so it only serializes Width of 53
// but since our default is Ellipse, if Height is unset and we use the default
// height of 30, then your ink that looked like 53,53 in V1 will look
// like 30,53 here.
//
//
stylusHeight = stylusWidth;
da.HeightChangedForCompatabity = true;
}
// need to convert width/height into Avalon, since they are stored in HIMETRIC in ISF
stylusHeight *= StrokeCollectionSerializer.HimetricToAvalonMultiplier;
stylusWidth *= StrokeCollectionSerializer.HimetricToAvalonMultiplier;
// Map 0.0 width to DrawingAttributes.DefaultXXXXXX (V1 53 equivalent)
double height = DoubleUtil.IsZero(stylusHeight) ? (Double)DrawingAttributes.GetDefaultDrawingAttributeValue(KnownIds.StylusHeight) : stylusHeight;
double width = DoubleUtil.IsZero(stylusWidth) ? (Double)DrawingAttributes.GetDefaultDrawingAttributeValue(KnownIds.StylusWidth) : stylusWidth;
da.Height = GetCappedHeightOrWidth(height);
da.Width = GetCappedHeightOrWidth(width);
//
// 3) next we need to set IsHighlighter (by looking for RasterOperation.MaskPen)
//
//
// always store raster op
//
da.RasterOperation = rasterOperation;
if (rasterOperation == DrawingAttributeSerializer.RasterOperationDefaultV1)
{
//
// if rasterop is default, make sure IsHighlighter isn't in the EPC
//
if (da.ContainsPropertyData(KnownIds.IsHighlighter))
{
da.RemovePropertyData(KnownIds.IsHighlighter);
}
}
else
{
if (rasterOperation == DrawingAttributeSerializer.RasterOperationMaskPen)
{
da.IsHighlighter = true;
}
}
//else, IsHighlighter will be set to false by default, no need to set it
//
// 4) see if there is a transparency we need to add to color
//
if (transparency > DrawingAttributeSerializer.TransparencyDefaultV1)
{
//note: Color.A is set to 255 by default, which means fully opaque
//transparency is just the opposite - 0 means fully opaque so
//we need to flip the values
int alpha = MathHelper.AbsNoThrow(transparency - 255);
Color color = da.Color;
color.A = Convert.ToByte(alpha);
da.Color = color;
}
return cbTotal;
}