How to show print dialogue when i press control + P on print preview Dialog

54 Views Asked by At

I created a form that has printpreview dialog and set the print button tool for show print dialog like this

1

this is a code

    public partial class frmTest : Form
        {
                 public frmTest()
                   {
                      InitializeComponent();
                   }

             private void button1_Click(object sender, EventArgs e)
              {
                 PrintPreviewDialog printPrvDlg = new PrintPreviewDialog();         
                 ToolStripButton b = new ToolStripButton();
                 b.Image = ((System.Windows.Forms.ToolStrip) 
                 (printPrvDlg.Controls[1])).ImageList.Images[0];
                 b.DisplayStyle = ToolStripItemDisplayStyle.Image;
                 b.Click += printPreview_PrintClick;
                ((ToolStrip)(printPrvDlg.Controls[1])).Items.RemoveAt(0);
                ((ToolStrip)(printPrvDlg.Controls[1])).Items.Insert(0, b);
                 printPrvDlg.ShowDialog();
              }
            private void printPreview_PrintClick(object sender, EventArgs e)
              {
                 PrintDialog printDlg = new PrintDialog();
                 printDlg.ShowDialog();  
              }

}

when the ptintpreview Dialog appear and i clicked the printer button it's ok to show printDialog but i want to use keyboard ctrl+P to show PrintDialog instead of Clicking Does Anyone feel free to help me thank you

0

There are 0 best solutions below