using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
public class Form1 : System.Windows.Forms.Form
{
public static float WXmin;
public static float WYmin;
public static float WXmax;
public static float WYmax;
public static int VXmin;
public static int VYmin;
public static int VXmax;
public static int VYmax;
public static float Vx;
public static float Vy;
public Form1()
{
InitializeComponent();
}
private void InitializeComponent()
{
//this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(400, 300);
this.Text="Pass Args";
this.Paint += new System.Windows.Forms.PaintEventHandler(this.doLine);
}
static void Main()
{
Application.Run(new Form1());
}
private void doLine(object sender, System.Windows.Forms.PaintEventArgs e)
{
Graphics g = e.Graphics;
g.FillRectangle(Brushes.White, this.ClientRectangle);
Pen p = new Pen(Color.Black);
g.DrawLine(p, 0, 0, 100, 100);
p.Dispose();
}
private void eachCornerPix (object sender, PaintEventArgs e, out float Wx, out float Wy, out float Vx, out float Vy)
{
Graphics g = this.CreateGraphics();
Pen penBlu = new Pen(Color.Blue, 2);
SolidBrush redBrush = new SolidBrush(Color.Red);
int width = 2; // 1 pixel wide in x
int height = 2;
float [] Wxc = {0.100f, 5.900f, 5.900f, 0.100f};
float [] Wyc = {0.100f, 0.100f, 3.900f, 3.900f};
for (int i = 0; i<3; i++)
{
Wx = Wxc[i];
Wy = Wyc[i];
Vx = ((Wx - WXmin)*((VXmax-VXmin)+VXmin)/(WXmax-WXmin));
Vy = ((Wy - WYmin)*(VYmax-VYmin)/(WYmax-WYmin)+VYmin);
Console.WriteLine("eachCornerPix Vx= {0}", Vx);
Console.WriteLine("eachCornerPix Vy= {0}", Vy);
g.FillRectangle(redBrush, Vx, Vy, width, height);
g.Dispose();
}
// Desired effect: Use the array values (Wxc, Wyc) and re-assign them to Wx and Wy. Then use
// Wx and Wy as components to calculate Vx and Vy.
// My end goal...once compile issues are resolved, is to pass each array value listed
// using this method. This should allow 4 xy point pairs to be plotted.
// Errors:
// pass1.cs(51,18): error CS0177: The out parameter 'Wx' must be assigned to before
// control leaves the current method
// pass1.cs(51,18): error CS0177: The out parameter 'Wy' must be assigned to before
// control leaves the current method
// pass1.cs(51,18): error CS0177: The out parameter 'Vx' must be assigned to before
// control leaves the current method
// pass1.cs(51,18): error CS0177: The out parameter 'Vy' must be assigned to before
// control leaves the current method
}
}