フォーム上の2つのユーザー定義スポット間の角度を測定できるツールを作成したいと思います。現時点ではこれを行うためのコードがないので、どんなコードでもいただければ幸いです。
ありがとう
アップデート
それは度である必要があり、私のポイントは3つのピクチャーボックスであり、角度を測定するために3つのポイントのそれぞれに異なる色が付いています。
アップデート
これは私の新しい現在のコードです:
namespace Angle_Measurer_Tool
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
int Dotter = 0;
private void button1_Click(object sender, EventArgs e)
{
Dotter = 1;
}
public int Distance2D(int x1, int y1, int x2, int y2)
{
int result = 0;
double part1 = Math.Pow((x2 - x1), 2);
double part2 = Math.Pow((y2 - y1), 2);
double underRadical = part1 + part2;
result = (int)Math.Sqrt(underRadical);
return result;
}
private void pictureBox1_MouseClick(object sender, MouseEventArgs e)
{
if (Dotter == 1)
{
dot1.Visible = true;
dot1.Location = e.Location;
Dotter = 2;
}
else if (Dotter == 2)
{
dot2.Visible = true;
dot2.Location = e.Location;
Dotter = 3;
}
else if (Dotter == 3)
{
dot3.Visible = true;
dot3.Location = e.Location;
Dotter = 4;
}
else if (Dotter == 4)
{
dot1.Visible = false;
dot2.Visible = false;
dot3.Visible = false;
Dotter = 1;
}
anglesize.Text = Convert
.ToInt32(Distance2D(
dot1.Location,
dot2.Location,
dot3.Location))
.ToString();
}
}
}
私の問題は、anglesizeと呼ばれる私が作成したラベルに実際に角度のサイズを入れる線です。