codice:
private void scontrino_Paint(object sender, PaintEventArgs e)
{
int fuori = 0;
String drawString = "Diano pizza";
Font drawFont = new Font("Arial", 14);
Font drawFont2 = new Font("Arial", 10);
SolidBrush drawBrush = new SolidBrush(Color.Black);
float x = 10.0F;
float y = 10.0F;
float width = 200.0F;
float height = 50.0F;
RectangleF drawRect = new RectangleF(x, y, width, height);
Pen blackPen = new Pen(Color.Black);
e.Graphics.DrawRectangle(blackPen, x, y, width, height);
PointF cogn = new PointF(10.00F, 100.00F);
PointF abit = new PointF(10.00F, 130.00F);
PointF scal = new PointF(10.00F, 160.00F);
PointF inter = new PointF(10.00F, 190.00F);
PointF num = new PointF(10.00F, 220.00F);
StringFormat drawFormat = new StringFormat();
drawFormat.Alignment = StringAlignment.Center;
e.Graphics.DrawString(drawString, drawFont, drawBrush, drawRect, drawFormat);
e.Graphics.DrawString("Cognome: "+cognome, drawFont2, drawBrush, cogn);
e.Graphics.DrawString("Abitazione: " + abitazione, drawFont2, drawBrush, abit);
e.Graphics.DrawString("Scala: " + scala, drawFont2, drawBrush, scal);
e.Graphics.DrawString("Interno: " + interno, drawFont2, drawBrush, inter);
e.Graphics.DrawString("Numero: " + numero, drawFont2, drawBrush, num);
e.Graphics.DrawString("Ordine:", drawFont, drawBrush, 10.00F, 250.00F);
for (int i = 0; i < ordini.Count(); i++)
{
PointF elem = new PointF(10.00F, 280.00F+(i*15));
PointF prezz = new PointF(200.00F, 280.00F + (i * 15));
e.Graphics.DrawString(ordini.ElementAt(i), drawFont2, drawBrush, elem);
e.Graphics.DrawString("€ "+Convert.ToString( prezziScelt.ElementAt(i)), drawFont2, drawBrush, prezz);
fuori = i;
}
e.Graphics.DrawString("Totale: € " + Convert.ToString(conto), drawFont, drawBrush, 100.00F, 310.00F + (fuori * 15));
e.Graphics.DrawString("Orario: " + orario, drawFont, drawBrush, 100.00F, 330.00F + (fuori * 15));
//FAI STAMPARE QUI
}
}
}