Example #1
0
        /// <summary>
        /// 打印窗体控件
        /// </summary>
        /// <param name="control">控件对象</param>
        public static void Print(Control control)
        {
            ScreenCapture capture = new ScreenCapture();
            Image         image   = capture.CaptureWindow(control.Handle);

            ImagePrintHelper helper = new ImagePrintHelper(image);

            helper.PrintPreview();
        }
Example #2
0
        /// <summary>
        /// 弹出打印窗体的预览对话框
        /// </summary>
        /// <param name="form">窗体对象</param>
        public static void Print(Form form)
        {
            ScreenCapture capture = new ScreenCapture();
            Image         image   = capture.CaptureWindow(form.Handle);

            ImagePrintHelper helper = new ImagePrintHelper(image);

            helper.PrintPreview();
        }
Example #3
0
        private void btnPrintImage_Click(object sender, EventArgs e)
        {
            ImagePrintHelper imagePrint = new ImagePrintHelper(this.pictureBox1.Image, Path.GetFileName(this.txtFilPath.Text));

            imagePrint.AllowPrintShrink  = true;
            imagePrint.AllowPrintCenter  = true;
            imagePrint.AllowPrintEnlarge = true;
            imagePrint.AllowPrintRotate  = true;
            imagePrint.PrintWithDialog();//弹出打印对话框,确认进行打印
        }
Example #4
0
        private void btnPrintView_Click(object sender, EventArgs e)
        {
            ImagePrintHelper imagePrint = new ImagePrintHelper(this.pictureBox1.Image, Path.GetFileName(this.txtFilPath.Text));

            imagePrint.PrintPreview();//弹出打印预览页面
        }