Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这个功能:
private void RightTap_Rotate(object sender, RightTappedRoutedEventArgs e) { var obj = (CompositeTransform)N.RenderTransform; obj.Rotation += 90; }
因此,右键单击网格 (N) 后,它会旋转到 90,但不是围绕光标位置(是的,在左角附近)。
我需要用什么来围绕光标旋转它?
设置变换的中心点:
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; }