我有这个功能:
private void RightTap_Rotate(object sender, RightTappedRoutedEventArgs e)
{
var obj = (CompositeTransform)N.RenderTransform;
obj.Rotation += 90;
}
因此,右键单击Grid(N)后,它会旋转到90,但不会在光标位置周围(左边角落,是的)。
我需要使用什么来围绕光标旋转它?
答案 0 :(得分:1)
设置转换的中心点:
private void RightTap_Rotate(object sender, RightTappedRoutedEventArgs e)
{
var obj = (CompositeTransform)N.RenderTransform;
Point cursorPos = Mouse.GetPosition(yourControl);
obj.CenterX = cursorPos.X;
obj.CenterY = cursorPos.Y;
obj.Rotation += 90;
}