سلام
این کد برای پرینت گرفتن است ولی موقع پرینت کل صفحه A4 را نمی گیرد.
چطور می توانم سایز پرینت را مشخص کنم که مثلاً کل A4 یا A5 پرینت بگیرد؟؟؟
namespace
WindowsFormsApplication2
{
publicpartialclassForm1 : Form
{
public Form1()
{
InitializeComponent();
}
Bitmap memoryImage;
privatevoid CaptureScreen()
{
Graphics myGraphics = this.CreateGraphics();
Size s = this.Size;
memoryImage =
newBitmap(s.Width, s.Height, myGraphics);
Graphics memoryGraphics = Graphics.FromImage(memoryImage);
memoryGraphics.CopyFromScreen(
this.Location.X, this.Location.Y, 0, 0, s);
}
privatevoid printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
e.Graphics.DrawImage(memoryImage, 0, 0);
}
privatevoid button1_Click(object sender, EventArgs e)
{
CaptureScreen();
printDocument1.Print();
}
privatevoid Form1_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'RadmanDataSet.tblLetter' table. You can move, or remove it, as needed.
this.tblLetterTableAdapter.Fill(this.RadmanDataSet.tblLetter);
this.reportViewer1.RefreshReport();
}
}
}