This is a migrated thread and some comments may be shown as answers.

Print Preview Key Press Event

1 Answer 70 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Saif
Top achievements
Rank 2
Saif asked on 22 Jun 2014, 11:51 AM
Hi, 

I want to know how to apply the key press on print preview style of the scheduler.
If user press arrow up/down it will go to next/previous page.

Thanks.

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 23 Jun 2014, 08:06 AM
Hello Saif,

Thank you for writing.

Here is how you can extend the print preview dialog in order to achieve your requirement: 
RadPrintDocument document = new RadPrintDocument();
 
 private void radButton1_Click(object sender, EventArgs e)
 {
     document.AssociatedObject = radScheduler1;
 
     MyRadPrintPreviewDialog dialog = new MyRadPrintPreviewDialog();
     dialog.Document = document;
     dialog.ShowDialog();
 }
 
 class MyRadPrintPreviewDialog : RadPrintPreviewDialog
 {
     protected override void OnLoad(EventArgs e)
     {
         base.OnLoad(e);
 
         CommandBarTextBox txtBox = this.ToolCommandBar.Rows[0].Strips[1].Items[2] as CommandBarTextBox;
         txtBox.KeyDown += txtBox_KeyDown;
     }
 
     void txtBox_KeyDown(object sender, KeyEventArgs e)
     {
         if (e.KeyCode == Keys.Down)
         {
             if (this.printPreviewControl.StartPage < this.Document.PageCount)
             {
                 this.printPreviewControl.StartPage++;
             }
         }
         else if (e.KeyCode == Keys.Up)
         {
             if (this.printPreviewControl.StartPage > 0)
             {
                 this.printPreviewControl.StartPage--;
             }
         }
     }
 }

I hope that you find this information useful. Should you have any other questions or suggestions, do not hesitate to contact us.

Regards,
Stefan
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
Scheduler and Reminder
Asked by
Saif
Top achievements
Rank 2
Answers by
Stefan
Telerik team
Share this question
or