开发者

send PrindDocument to another form

i want send printDocument to second form to showing that in printPreviewControl which placed in second form.

form1 code

defined printDocument class with public access in form1

public System.Drawing.Printing.PrintDocument printDocument;

form2 code

private void Form2_Load(object sender, EventArgs e)
{
        Form1 form1 = new Form1;
        printPreview开发者_运维百科Control.Document = form1.printDocument;
}

I am sure printDocument in form1 have document to print, but when form2 loaded nothing showed in printPreviewControl. what method of printDocument in form1 should be call before showing form2?


Your example should work fine but the PrintPreviewControl will only render what it is fed during the PrintPage event that is attached to the PrintDocument.

If you aren't doing anything during the PrintPage event then the print preview will be a blank document.

Chances are that if you put to PrintPreviewControl on Form1 then you will recieve the same behavior.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜