本文介绍了c#中的点原型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个代码,我想在点击按钮时发送pt1和pt2方法我在pt1原型和pt2中有问题

我的问题是

Point pt1 = 4428900.38515348;

点pt2 = 4428900.38515346;

我不能为这个virables设置这个数字(double num),因为pt1和pt2的原型和我希望这个virables有原型Point

我应该做些什么改变?



我尝试了什么:



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
My problem is
Point pt1 = 4428900.38515348;
Point pt2 = 4428900.38515346;
Ican't set this number(double num) to this virables because the prototype of pt1 and pt2 and I want this virables have prototype Point
what is the change I should to do ?

What I have tried:

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;          
}

推荐答案


这篇关于c#中的点原型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-25 08:08