Rotate graphic towards mouse in WPF (like an analog dial)

后端 未结 3 1383
臣服心动
臣服心动 2020-12-29 14:48

In WPF/C# how would I rotate a \"graphic\" to face the current mouse position?

Basically what I want is a \"wheel\" UI Control (like an analog volume dial

3条回答
  •  心在旅途
    2020-12-29 15:27

    To add to that post, the angle between the mouse point and the object point is calculated like:

    dot = currentLocation.X * objectPosition.X + currentLocation.Y * objectPosition.Y;
    angle = Math.Acos(dot);
    

提交回复
热议问题