Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27184

PrintPreviewDialog Control Menu

$
0
0
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:
Code:

   
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Form2.Show()
        Hide()
    End Sub

Form2: Is empty Form with PrintPreviewControl - streched in all Form2. Here is code that I use:
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

So when you start application, fill datagridview and click Button1 for print it opens Form2:

Name:  Form2.JPG
Views: 26
Size:  17.0 KB

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:
Name:  Control1.JPG
Views: 41
Size:  11.0 KB

If I use code:
Code:

PrintPreviewDialog1.ShowDialog()
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.

Any Ideas, realy thanks in advance...

Daniel
Attached Images
  

Viewing all articles
Browse latest Browse all 27184

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>