I am trying to print out items I have saved. Each item contains a id number (ex. 34534), description( ex. book) and a barcode representation of the id number. My problem is that the barcode does not stay right below the id number. I would like for it to be in the next line or even be able to group it all in a rectangle, like you would normally see on a book/etc.
Can anyone offer suggestions or point me in the right direction?
private void uxPrintAll_Click(object sender, EventArgs e)
{
string result = "", result2 = "";
printItemsList = storage.GetList();
// Builds string to be printed
for (int i = 0; i < printItemsList.Count; i++)
{
// Description and id number
result += "Description: " + printItemsList[i].Description + "\n" + "UPC Code: " + printItemsList[i].ID + "\n\n\n\n";
// id number used to be changed into barcode font
result2 += "\n" + printItemsList[i].ID + "\n";
}
PrintDocument p = new PrintDocument();
p.PrintPage += delegate(object sender1, PrintPageEventArgs e1)
{
e1.Graphics.DrawString(result, new Font("Times New Roman", 12), new SolidBrush(Color.Black),
new RectangleF(0, 0, p.DefaultPageSettings.PrintableArea.Width, p.DefaultPageSettings.PrintableArea.Height));
e1.Graphics.DrawString(result2, new Font(pfc.Families[0], 30), new SolidBrush(Color.Black),
new RectangleF(0, 0, p.DefaultPageSettings.PrintableArea.Width, p.DefaultPageSettings.PrintableArea.Height));
};
try
{
p.Print();
}
catch (Exception ex)
{
throw new Exception("Exception Occured While Printing", ex);
}
}