I have this code ,I want to send pt1 and pt2 when click on button to method I have problem in prototype of pt1 and pt2 what is the change I should to do ?
public double angleOf(Point p1, Point p2)
{
double deltaY = (p2.Y - p1.Y);
double deltaX = (p2.X - p1.X);
double result = Math.Atan2(deltaY, deltaX);
result *= (180 / Math.PI);
result += 22.5;
return (result < 0) ? (360d + result) : result;
}
private void button1_Click(object sender, EventArgs e)
{
double angle;
Point pt1 = 4428900.38515348;
Point pt2 = 4428900.38515346;
angle = angleOf(pt1, pt2);
textBox1.Text += angle;
9 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.

ali tuncerPosted Feb 17, 2016, 8:22 PM
I am not sure what you are trying to do, but if you need to use angleOf method, you need to create 2 points, such as :
Point pt2 = new Point(200, 200);
angle = angleOf(pt1, pt2);
textBox1.Text += angle;
meena moonPosted Feb 17, 2016, 4:45 PM
ali tuncerPosted Feb 14, 2016, 8:14 PM
angleOf method takes Point as a parameter.
angle = angleOf(xy.X, xy.Y) // in this line you are sending int, that's what the error message says.
meena moonPosted Feb 14, 2016, 12:05 PM
ali tuncerPosted Feb 14, 2016, 2:37 AM
Point pt1 = 4428900.38515348; // this line of code will not build successfully
meena moonPosted Feb 12, 2016, 1:11 PM
Shweta LodhaPosted Feb 12, 2016, 12:41 PM
meena moon,
meena moonPosted Feb 12, 2016, 12:33 PM
Suresh MPosted Feb 12, 2016, 4:52 AM