private static void getCorners(out float Wx, out float Wy, out float Vx, out float Vy)
{
// note-- I don't know how to flip the Y axis using this method...
// this is not a "graphics" method
// In other words, I should use something like:
// flipY(object sender, System.EventArgs e);
// but don't know the syntax or whatever
// I tried to do this:
//Graphics g = this.CreateGraphic
//Matrix myMatrix2 = new Matrix(1, 0, 0, -1, 0, 0); // flip Y axis
//g.Transform = myMatrix2;
//g.TranslateTransform(0, 480, MatrixOrder.Append);
// ...but I get the error:
// error CS0026: Keyword 'this' is not valid in a static property, static method, or
// static field initializer
Wx = 1.00F;
Wy = 1.00F; // make this 1.00 (not 3.00F) down from the TOP since cannot get Y flipped
Vx = ((Wx- WXmin)*((VXmax-VXmin)+VXmin)/(WXmax-WXmin));
Vy = ((Wy-WYmin)*(VYmax-VYmin)/(WYmax-WYmin)+VYmin);
}
views:
48answers:
1
A:
The primary problem with your code - the reason it won't compile - is that you are attempting to call an instance method (via the this
keyword) from a static method.
Removing the static
keyword from the getCorners
method should get you going. Apart from that, I am a little unclear on what you are asking. For more help on graphics programming in windows forms, here is a brief tutorial.
http://www.techotopia.com/index.php/Drawing_Graphics_in_C_Sharp
mcliedtk
2010-03-22 07:52:56