T
Thomas Bauer
Hello,
how can I make the transformation matrix?
Zero point
Left top
Left bottom
Right top
Right bottom
I have a list of points
private void Form1_Load(object sender, EventArgs e)
{
ListCodes = new List<CODES>();
CODES obj;
int boardnumber = 0;
for (int j = 0; j < 4; j++)
{
for (int i = 0; i < 5; i++)
{
boardnumber++;
obj = new CODES();
obj.Init();
obj.X = obj.X + (j * 150);
obj.Y = obj.Y + (i * 70);
obj.BoardNumber = boardnumber;
ListCodes.Add(obj);
}
}
}
Regards Thomas
private void MapMillimetersToPixels(Graphics gfx, Rectangle
rectPixels, Rectangle rectMm)
{
Matrix matrix = new Matrix();
ScaleX = (float)rectPixels.Width / rectMm.Width;
ScaleY = (float)rectPixels.Height / rectMm.Height;
matrix.Scale(ScaleX, ScaleY);
matrix.Translate(rectPixels.Left - ScaleX * rectMm.Left,
rectPixels.Top - ScaleY * rectMm.Top);
gfx.Transform = matrix;
}
how can I make the transformation matrix?
Zero point
Left top
Left bottom
Right top
Right bottom
I have a list of points
private void Form1_Load(object sender, EventArgs e)
{
ListCodes = new List<CODES>();
CODES obj;
int boardnumber = 0;
for (int j = 0; j < 4; j++)
{
for (int i = 0; i < 5; i++)
{
boardnumber++;
obj = new CODES();
obj.Init();
obj.X = obj.X + (j * 150);
obj.Y = obj.Y + (i * 70);
obj.BoardNumber = boardnumber;
ListCodes.Add(obj);
}
}
}
Regards Thomas
private void MapMillimetersToPixels(Graphics gfx, Rectangle
rectPixels, Rectangle rectMm)
{
Matrix matrix = new Matrix();
ScaleX = (float)rectPixels.Width / rectMm.Width;
ScaleY = (float)rectPixels.Height / rectMm.Height;
matrix.Scale(ScaleX, ScaleY);
matrix.Translate(rectPixels.Left - ScaleX * rectMm.Left,
rectPixels.Top - ScaleY * rectMm.Top);
gfx.Transform = matrix;
}