x0, y0 + height); p4=new Point (x0 + width, y0 + height); (p1, p2); (p1, p3); (p3, p4); (p4, p2) ;. X=width; .Y=height;
}
} class matrixTable: Matrix
{Cell cell; x; y; matrixTable (int rowCount, int columnCount)
{= new Cell (45, 25) ;. rowCount=rowCount; .columnCount=columnCount;
} override void Draw (int x0, int y0)
{= x0;=y0; .Begin (BeginMode.Lines); (int i=0; i lt; rowCount; i ++)
{(int j=0; j lt; columnCount; j ++)
{. Draw (x0 + cell.width * j, y0 + cell.height * i);
}
}. X=cell.width * columnCount; .Y=cell.height * rowCount; .End ();
} void drawText (TextureFont texFont, Point resolution)
{(int i=0; i lt; rowCount; i ++)
{text=new cellText (45, 25, Convert.ToString (i)) ;. drawVertical (x, resolution.Y - y - cell.height * i - 25, texFont, resolution);
} (int j=0; j lt; columnCount; j ++)
{text=new cellText (45, 25, Convert.ToString (j)) ;. drawHorizontal (x + cell.width * j, resolution.Y - y + 7, texFont, resolution);
}
}
} class matrix: Matrix
{double [,] mtx; mtxTab; matrix (int rowCount, int columnCount)
{. rowCount=rowCount; .columnCount=columnCount;=new double [rowCount, columnCount];=new matrixTable (rowCount, columnCount);=new Point (45 * columnCount, 25 * rowCount);
} void Draw (string operation, int x0, int y0, TextureFont texFont, Point resolution)
{y=resolution.Y - 11 - y0; M=Convert.ToDouble (mtx.GetLength (1));
double dx=0;//Інтервал між ціфраміdy=0;//Інтервал між рядками
for (int i=0; i lt; mtx.GetLength (0); i ++)
{(int j=0; j lt; mtx.GetLength (1); j ++)
{= dx + 45; .WriteStringAt (Convert.ToString (mtx [i, j]), 20, x0 + dx - 20, y + dy, 0, resolution);
}=dx - 45 * (M);=dy - 25;
} text=new matrixText (operation, rowCount, columnCount) ;. draw (x0, y0, texFont, resolution) ;. Disable (EnableCap.Texture2D); (x0, y0) ;. Enable ( EnableCap.Texture2D) ;. drawText (texFont, resolution);
} override void Draw (int x0, int y0)
{. Draw (x0, y0);
} void setMatrix (DataGridView dataGridView1)//Записує матрицю в список
{(int i=0; i lt; rowCount; i ++)
{(int j=0; j lt; columnCount; j ++)
{[i, j]=Convert.ToDouble (dataGridView1.Rows [i] .Cells [j] .Value);
}
}
} bool Contains (Point point, int x0, int y0)
{contains=false; GraphicsPathRectangle=new GraphicsPath (); RectangleDraw=new Rectangle (x0, y0, size.X, size.Y) ;. AddRectangle (RectangleDraw); (GraphicsPathRectangle.IsVisible (point ))
{= true;
} contains;
}
} class matrixText: matrix
{string text; int width; int height; matrixText (string text, int rowCount, int columnCount)
: base (rowCount, columnCount)
{. text=text;=new Point (45 * columnCount, 25 * rowCount);
} Point calculateLocation ()
{location=new Point (0, 0) ;. X=this.size.X - size.X - 20; .Y=this.size.Y/2; location;
}
//x, y - координати табліциvoid draw (int x, int y, TextureFont texFont, Point resolution)
{. WriteStringAt (text, 20, x - 18, resolution.Y - y, 0, resolution);
}
} class cellText: Cell
{string text; cellText (int width, int height, string text)
: base (width, height)
{. text=text;
} void drawVertical (int x, int y, TextureFont texFont, Point resolution)
{. WriteStringAt (text, 10, x - 4, y + (this.height/2), 0, resolution);
} void drawHorizontal (int x, int y, TextureFont texFont, Point resolution)
{. WriteStringAt (text, 10, x + (this.width/2), y, 0, resolution);
}
}
public static class matrixOperations
{
# region//Множення, додавання, вичітаніеstatic d...