using System.Drawing to graph 9 ellipses. First problem how do you initialize "PaintEventArgs" in Default.aspx. Second problem is if first problem does not solve it then what is wrong with my code?
protected void Page_Load(object sender, PaintEventArgs e)
{
...
using (Bitmap xPanel = new Bitmap(50, 50))
{
using (Graphics objGraphicPanel = Graphics.FromImage(xPanel))
{
SolidBrush whiteBrush = new SolidBrush(Color.White);
objGraphicPanel.FillRectangle(whiteBrush, 0, 0, 200, 200);
Pen colorPen = new Pen(Color.Black, 2);
MemoryStream ms = new MemoryStream();
for (k = 1; k <= 9; k++)
{
for (int nn = 2; nn <= n; nn++)
{
float x1 = Convert.ToSingle(XYecl[k, nn - 1]);
float y1 = Convert.ToSingle(ZYecl[k, nn - 1]);
float x2 = Convert.ToSingle(XYecl[k, nn]);
float y2 = Convert.ToSingle(ZYecl[k, nn]);
PointF[] ptf =
{
new PointF(x1, y1),
new PointF(x2, y2)
};
objGraphicPanel.DrawLines(colorPen, ptf);
xPanel.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
}
}
string Imgbase64 = Convert.ToBase64String(ms.ToArray());
MyImage.Src = "data:image/gif;base64," + Imgbase64;
objGraphicPanel.Dispose();
}
xPanel.Dispose();
}
What I have tried:
I tried to insert an "F" after each data XYecl[k,nn] and ZYecl[k,nn] but I could not figure that out.