hi,
could anybody solve this problem
here is my code
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.IO;
namespace notepad_demo
{
public partial class Form2 : Form
{
bool page = true;
public Form2()
{
InitializeComponent();
}
private void Form2_Load(object sender, EventArgs e)
{
this.pictureBox1.Location = new Point(16, 13);
this.pictureBox1.Width = 850;
this.pictureBox1.Height = 5750;
this.panel1.Width = 850;
this.panel1.Height = 600;
}
private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
using (Font myFont = new Font("Arial", 14))
{
e.Graphics.DrawString("Hello 1", myFont, Brushes.Green, new Point(2, 2));
e.Graphics.DrawString("Hello 2", myFont, Brushes.Green, new Point(2, 20));
e.Graphics.DrawString("Hello 3", myFont, Brushes.Green, new Point(2, 120));
e.Graphics.DrawString("Hello 4", myFont, Brushes.Green, new Point(2, 200));
e.Graphics.DrawString("Hello 5", myFont, Brushes.Green, new Point(2, 302));
e.Graphics.DrawString(textBox1.Text, myFont, Brushes.Green, new Point(2, 502));
}
}
private void button1_Click(object sender, EventArgs e)
{
printDialog1.Document = printDocument1;
if (printDialog1.ShowDialog() == DialogResult.OK)
{
printDocument1.Print();
}
}
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
if (page)
{
float x = 20;
float y = 100;
Bitmap bmp = new Bitmap(this.pictureBox1.Width, this.pictureBox1.Height);
this.pictureBox1.DrawToBitmap(bmp, new Rectangle(0, 0, this.pictureBox1.Width, this.pictureBox1.Height));
e.Graphics.DrawImage((Image)bmp, x, y);
e.HasMorePages = true;
page = false;
}
}
private void button2_Click(object sender, EventArgs e)
{
printPreviewDialog1.Document = printDocument1;
printPreviewDialog1.ShowDialog();
}
}
}
if i enterd more multi line text picturebox shown content ok,but not print full as per shown in picturebox.
its only print one page fit content balance text not print.