WPF用RenderTransform实现,随便做了个,代码如下。
XAML
xmlns="
xmlns:x="
Title="MainWindow"
Height="350"
Width="525">
Height="20">
CS如下
namespace WpfApplication3
{
///
/// MainWindow.xaml 的交互逻辑
///
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
DataContext = this;
}
private bool _ischecked = false;
public bool IsChecked
{
get
{
return _ischecked;
}
}
private void btnScale1_Click(object sender, RoutedEventArgs e)
{
st.CenterX = image.ActualWidth / 2;
st.CenterY = image.ActualHeight / 2;
st.ScaleX -= 0.1;
st.ScaleY -= 0.1;
}
private void btnScale2_Click(object sender, RoutedEventArgs e)
{
st.CenterX = image.ActualWidth / 2;
st.CenterY = image.ActualHeight / 2;
st.ScaleX += 0.1;
st.ScaleY += 0.1;
}
private void btnRotation1_Click(object sender, RoutedEventArgs e)
{
rt.CenterX = image.ActualWidth / 2;
rt.CenterY = image.ActualHeight / 2;
rt.Angle -= 10;
}
private void btnRotation2_Click(object sender, RoutedEventArgs e)
{
rt.CenterX = image.ActualWidth / 2;
rt.CenterY = image.ActualHeight / 2;
rt.Angle += 10;
}
private void btnMove1_Click(object sender, RoutedEventArgs e)
{
tt.X -= 10;
}
private void btnMove2_Click(object sender, RoutedEventArgs e)
{
tt.X += 10;
}
private void btnMove3_Click(object sender, RoutedEventArgs e)
{
tt.Y -= 10;
}
private void btnMove4_Click(object sender, RoutedEventArgs e)
{
tt.Y += 10;
}
}
}