0 svar
46 visningar
karu83 9 – Fd. Medlem
Postad: 31 aug 2020 14:27

layout:en på printDocument och PrintPreviewDialog vill inte samarbeta

När jag skriver koden för printDocument så ser det ok ut men sedan när man trycker på print så blir det en ända röra i print Preview.
Finns det något bättre sätt att bestämma hur det ska se ut i print Preview?

Dessa koderna använder jag mig av.


private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
e.Graphics.DrawString(receiptShowBox.Text, new Font("Arial", 11, FontStyle.Regular), Brushes.Black, new Point(0, 0));
}

vore ju bra om man kunde typ bestämma vart allt skulle vara etc?
som man kan göra så fint här...


private void btnReceipt_Click(object sender, EventArgs e)
{
receiptShowBox.Clear();
receiptShowBox.AppendText("\t" + "Export Manager" + "\n");
receiptShowBox.AppendText("\t" + "\t" + "22 Jump street" + "\n");
receiptShowBox.AppendText("=============================================" + "\n");
receiptShowBox.AppendText("Bags Accessories" + "\t" + "\t" + cmbBagsA.Text + "\t" + txtBagsA.Text + "\n");
receiptShowBox.AppendText("Belts Accessories" + "\t" + "\t" + cmbBeltsA.Text + "\t" + txtBeltA.Text + "\n");
receiptShowBox.AppendText("Neckless Accessories" + "\t" + cmbNecklessA.Text + "\t" + txtNecklessA.Text + "\n");
receiptShowBox.AppendText("Pillow Accessories" + "\t" + "\t" + cmbPillowsA.Text + "\t" + txtPillowsA.Text + "\n");
receiptShowBox.AppendText("Pins Accessories" + "\t" + "\t" + cmbPinsA.Text + "\t" + txtPinsA.Text + "\n");
receiptShowBox.AppendText("Tax" + "\t" + "\t" + "\t" + txtTax.Text + "\n");
receiptShowBox.AppendText("SubTotal" + "\t" + "\t" + "\t" + txtSubTotal.Text + "\n");
receiptShowBox.AppendText("Total" + "\t" + "\t" + "\t" + txtTotal.Text + "\n");
receiptShowBox.AppendText("=============================================" + "\n");
receiptShowBox.AppendText("\t" + "Thank you and welcome back another day ");
}
Svara Avbryt
Close