SAI的拙劣仿制:很多人永远也不会尝试的东西
2010-12-01 11:09 Nana's Lich 阅读(2361) 评论(0) 收藏 举报MainWindow.xaml
<Window x:Class="wpfStylusDemo.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="600" Width="800" PreviewKeyDown="Window_PreviewKeyDown"
Background="{StaticResource {x:Static SystemColors.AppWorkspaceBrushKey}}">
<InkCanvas Width="640" Height="480" VerticalAlignment="Center" HorizontalAlignment="Center" Name="inkCanvas1">
<InkCanvas.LayoutTransform>
<RotateTransform/>
</InkCanvas.LayoutTransform>
</InkCanvas>
</Window>
MainWindow.xaml.cs
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
namespace wpfStylusDemo
{
///
/// MainWindow.xaml 的交互逻辑
///
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
const double c_angle = 15;
private void Window_PreviewKeyDown(object sender, KeyEventArgs e)
{
if (Key.End == e.Key || Key.Delete == e.Key)
{
var rt = inkCanvas1.LayoutTransform as RotateTransform;
double angle = rt.Angle;
if (Key.Delete == e.Key)
angle -= c_angle;
else
angle += c_angle;
rt.Angle = angle % 360;
}
}
}
}
奇怪的是这些人却总是在抱怨技术变化得太快。
浙公网安备 33010602011771号