السلام عليكم و رحمة الله و بركاته
حياكم الله على هذا المجهود الرائع فى مساعدة الناس كتبه الله فى ميزان حسناتكم
أريد بعض المساعده من اخواننا لأستفيد و غيرى ايضا عندما يقرأ الموضوع ايضا يستفيد
أنا عملت windows application
وعندى listview فيها مجموعة من البيانات المتغيرة
ويوجد button يمكن يتم من خلاله فتح نافذة جديدة وهى عبارة عن طباعة محتوى معين
أريد ان يمتلئ هذا المحتوى ب listview
وهذا هو الكود المستخدم
private void iconits3_Click(object sender, EventArgs e)
{
try
{
PrintPreviewDialog preview = new PrintPreviewDialog();
PrintDocument document = new PrintDocument();
document.PrintPage += new PrintPageEventHandler(document_PrintPage);
preview.Document = document;
// Then show the dialog window.
preview.Show();
}
// Otherwise, just call the document.Print();
catch {
throw;
} protected void document_PrintPage(object sender, PrintPageEventArgs ev)
{
Font printFont = new Font("Arial", 14);
ev.Graphics.DrawString(DateTime.Now.ToLongDateString(), printFont, Brushes.Black, ev.MarginBounds.Left, ev.MarginBounds.Top, new StringFormat());
ev.Graphics.DrawString(ListView1.Items.ToString(), printFont, Brushes.Black, ev.MarginBounds.Left, ev.MarginBounds.Top, new StringFormat());
}