Ecco qui; ricordo che questa deve essere una DLL:
codice:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Librerie
{
public class Dummy
{
}
public class DoublePoint
{
private double x;
private double y;
public void SetX(double i)
{
x = i;
}
public double GetX()
{
return x;
}
public void SetY(double i)
{
y = i;
}
public double GetY()
{
return y;
}
public DoublePoint()
{
x = -1;
y = -1;
}
public DoublePoint(double dx, double dy)
{
x = dx;
y = dy;
}
} // Fine classe DoublePoint
/*public DoublePoint CalcolaCoordinate(double x, double y)
{
DoublePoint dptScreen = new DoublePoint(-2, -2);
try
{
double screenX = x - pnlGE.Location.X;
double screenY = y - pnlGE.Location.Y;
double midX = pnlGE.Width / 2;
double midY = pnlGE.Height / 2;
double outX = 0.0;
double outY = 0.0;
if (screenX < midX)
{
dptScreen.SetX((screenX / midX) - 1);
outX = (screenX / midX) - 1;
}
else if (screenX > midX)
{
dptScreen.SetX((screenX - midX) / midX);
outX = (screenX - midX) / midX;
}
else if (screenX == midX)
dptScreen.SetX(0.0);
if (screenY < midY)
{
dptScreen.SetY(1 - (screenY / midY));
outY = 1 - (screenY / midY);
}
else if (screenY > midY)
{
dptScreen.SetY(((pnlGE.Height - screenY) / midY) - 1);
outY = ((pnlGE.Height - screenY) / midY) - 1;
}
else if (screenY == midY)
{
dptScreen.SetY(0.0);
}
lblOutMouseX.Text = outX.ToString();
lblOutMouseY.Text = outY.ToString();
return dptScreen;
}
catch (Exception ex)
{
Cursor.Current = Cursors.Default;
MessageBox.Show("Error in DetermineScreenCoordinates().\n" +
ex.Message, "GETest", MessageBoxButtons.OK, MessageBoxIcon.Error);
return dptScreen;
}
} // Fine classe CalcolaCoordinate
*/
}