السلام عليكم
حصلت على هذا الكود من msdn
Dim linesPerPage As Integer = 0
' Sets the value of charactersOnPage to the number of characters
' of stringToPrint that will fit within the bounds of the page.
e.Graphics.MeasureString(stringToPrint, Me.Font, e.MarginBounds.Size, _
StringFormat.GenericTypographic, charactersOnPage, linesPerPage)
' Draws the string within the bounds of the page
e.Graphics.DrawString(stringToPrint, Me.Font, Brushes.Black, _
e.MarginBounds, StringFormat.GenericTypographic)
' Remove the portion of the string that has been printed.
stringToPrint = stringToPrint.Substring(charactersOnPage)
' Check to see if more pages are to be printed.
e.HasMorePages = stringToPrint.Length > 0وهو يقوم بحساب عدد الاسطر المطبوعة فيزيد عدد الصفحات بحسبها
مشكلتي هي ان الكود يقوم بالطباعة من ملف وانا اريد الطباعة من printdocument
فالسطر التالي من الكود هو محط اهتمامي
e.Graphics.DrawString(stringToPrint, Me.Font, Brushes.Black, e.MarginBounds, StringFormat.GenericTypographic)
فالكلمة stringToPrint هي النص المراد طباعته فلو استطعت ان اضع في مكانه النص الموجود في printdocument ربما حلت المشكلة
ارجو المساعدة