انشي مشروع جديد
انتقل لمحرر الشفرات اكتب الشفرة التالية:
PHP كود :
Dim WithEvents PD As New Printing.PrintDocument
اختر الاداة الجديدة من اعلى المحرر ثم الحدث كما المناسب او انسخ الشفرة التالية مباشرة:
PHP كود :
Private Sub PD_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PD.PrintPage e.Graphics.DrawImage(PictureBox1.Image, e.MarginBounds.Left, e.MarginBounds.Top) End Sub
ثم انقر الزر و اكتب الشفرة التنفيذية التالية :
PHP كود :
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click PD.Print() End Sub
Dim info As ProcessStartInfo = New ProcessStartInfo("ضع هنا مسار الملف المطلوب طباعته")
info.Verb = "Print"
info.CreateNoWindow = True
info.WindowStyle = ProcessWindowStyle.Hidden
Process.Start(info)