پرینت گرفتن از فرم

diehard2007

عضو جدید
با سلام و خسته نباشید به شما من از این کد برای پرینت گرفتن از فرمم استفاده می کنم ولی کیفیت صفحه پرینت شده خیلی پایینه نمی دونم مشکل از کجاست ؟

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.IO;
using System.Drawing.Printing;
namespace Mobile
{
public partial class frmTest : Form
{
public frmTest()
{
InitializeComponent();
}
[System.Runtime.InteropServices.DllImport("gdi32.dll")]
public static extern long BitBlt(IntPtr hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, IntPtr hdcSrc, int nXSrc, int nYSrc, int dwRop);
private Bitmap memoryImage;
private void CaptureScreen()
{
Graphics mygraphics = this.CreateGraphics();
Size s = this.Size;
memoryImage = new Bitmap(s.Width, s.Height, mygraphics);
Graphics memoryGraphics = Graphics.FromImage(memoryImage);
IntPtr dc1 = mygraphics.GetHdc();
IntPtr dc2 = memoryGraphics.GetHdc();
BitBlt(dc2, 0, 0, this.ClientRectangle.Width, this.ClientRectangle.Height, dc1, 0, 0, 13369376);
mygraphics.ReleaseHdc(dc1);
memoryGraphics.ReleaseHdc(dc2);
}
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
e.Graphics.DrawImage(memoryImage, 0, 0);
PrintDocument pd = new PrintDocument();
}
private void label15_Click(object sender, EventArgs e)
{
CaptureScreen();
printDocument1.Print();
}
}
}
 

HH2BN1990

کاربر فعال
تو ویژوال 2010 می تونستی تو ToolBox از قسمت Visual Basic Power Pack از کنترل PrintForm استفاده کنی !!!!
کد:
printForm1.Print();
 

Similar threads

بالا