Hello all, I have another problem with my project. I have create form from where I whant to print content. For that purpose, I have created new Form, which will show Preview page and print. So here are elements:
Form1: have content in datagridview and button for print. Here is code:
Form2: Is empty Form with PrintPreviewControl - streched in all Form2. Here is code that I use:Code:Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Form2.Show() Hide() End Sub
So when you start application, fill datagridview and click Button1 for print it opens Form2:Code:Public Class Form2 Private Sub Form2_FormClosed(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles MyBase.FormClosed Form1.Show() End Sub Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage Dim font1 As New Font("arial", 12, FontStyle.Regular) Dim ce = Form1.DataGridView1.CurrentCell.RowIndex e.Graphics.DrawString(Form1.DataGridView1.Item(Form1.Opis.HeaderText, ce).Value.ToString, font1, Brushes.Black, 200, 200) End Sub End Class
Problem that I have is that I whant to add PrintPreviewDialog Control Menu to Form2 that I have created:
This Control Menu I whant to add to Form2:
If I use code:It works, but opens two dialog, where in one dialog is content but, whitout Control Menu, in second dialog si Menu but no content. But this is not what I whant, I only need Control Menu to Form2.Code:PrintPreviewDialog1.ShowDialog()
Any Ideas, realy thanks in advance...
Daniel




Reply With Quote