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.
私の C# アプリケーションでは、マウスの移動角度の差を計算して、水平スクロールと垂直スクロールを制限したいと考えています。
60 度を超える角度は、垂直スクロールとして追跡する必要があります。
初期の X、Y 位置と現在の X、Y 位置があります。マウスの移動角度を計算するにはどうすればよいですか。
どんな助けでも大歓迎です。
これにより、ラジアンで角度が得られます。
int dx = Math.Abs(x2 - x1); int dy = Math.Abs(y2 - y1); double angleRadians = Math.Atan2(dy, dx); double angleDegrees = (angleRadians * 180)/Math.PI;
dxまたはが特定の数よりも小さい角度を無視することをお勧めしますdy(16 のような値がそれを行います)。
dx
dy