本文整理汇总了C#中System.Windows.Ink.StylusTip枚举的典型用法代码示例。如果您正苦于以下问题:C# StylusTip枚举的具体用法?C# StylusTip怎么用?C# StylusTip使用的例子?那么恭喜您, 这里精选的枚举代码示例或许可以为您提供帮助。
在下文中一共展示了StylusTip枚举的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: InkCanvas
InkCanvas inkCanvas1 = new InkCanvas();
DrawingAttributes inkDA;
DrawingAttributes highlighterDA;
bool useHighlighter = false;
// Add an InkCanvas to the window, and allow the user to
// switch between using a green pen and a purple highlighter
// on the InkCanvas.
private void WindowLoaded(object sender, EventArgs e)
{
inkCanvas1.Background = Brushes.DarkSlateBlue;
inkCanvas1.DefaultDrawingAttributes.Color = Colors.SpringGreen;
root.Children.Add(inkCanvas1);
// Set up the DrawingAttributes for the pen.
inkDA = new DrawingAttributes();
inkDA.Color = Colors.SpringGreen;
inkDA.Height = 5;
inkDA.Width = 5;
inkDA.FitToCurve = false;
// Set up the DrawingAttributes for the highlighter.
highlighterDA = new DrawingAttributes();
highlighterDA.Color = Colors.Orchid;
highlighterDA.IsHighlighter = true;
highlighterDA.IgnorePressure = true;
highlighterDA.StylusTip = StylusTip.Rectangle;
highlighterDA.Height = 30;
highlighterDA.Width = 10;
inkCanvas1.DefaultDrawingAttributes = inkDA;
}
// Create a button called switchHighlighter and use
// SwitchHighlighter_Click to handle the Click event.
// The useHighlighter variable is a boolean that indicates
// whether the InkCanvas renders ink as a highlighter.
// Switch between using the 'pen' DrawingAttributes and the
// 'highlighter' DrawingAttributes.
void SwitchHighlighter_Click(Object sender, RoutedEventArgs e)
{
useHighlighter = !useHighlighter;
if (useHighlighter)
{
switchHighlighter.Content = "Use Pen";
inkCanvas1.DefaultDrawingAttributes = highlighterDA;
}
else
{
switchHighlighter.Content = "Use Highlighter";
inkCanvas1.DefaultDrawingAttributes = inkDA;
}
}
开发者ID:.NET开发者,项目名称:System.Windows.Ink,代码行数:56,代码来源:StylusTip
注:本文中的System.Windows.Ink.StylusTip枚举示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论