Solved

Need to add to the following  avoid ctrl + p:

Posted on 2006-11-24
5
200 Views
Last Modified: 2010-04-16
case "keydown":
                        {                        
                              //MessageBox.Show(win.@event.keyCode.ToString());
                              if ((win.@event.ctrlKey) && (win.@event.keyCode == (int)System.Windows.Forms.Keys.C/*67*/))
                              {
                                    DoCopy();
                              }
                              else
                              {
                                    int keyCode = win.@event.keyCode;
                                    if ((!((win.@event.ctrlKey) && ((win.@event.keyCode == (int)System.Windows.Forms.Keys.F/*70*/) || (win.@event.keyCode == (int)System.Windows.Forms.Keys.End/*35*/) || (win.@event.keyCode == (int)System.Windows.Forms.Keys.Home/*36*/)))) &&
                                          (!(win.@event.keyCode >= (int)System.Windows.Forms.Keys.PageUp/*33*/) && (win.@event.keyCode <= (int)System.Windows.Forms.Keys.Down/*40*/)) || win.@event.keyCode == (int)System.Windows.Forms.Keys.F5/*116*/)
                                    {
                                          win.@event.returnValue = false;
                                          win.@event.cancelBubble = true;                                    
                                          win.@event.keyCode = 0;
                                    }
                              }
                              break;
                        }  
0
Comment
Question by:mathieu_cupryk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 18

Expert Comment

by:Ravi Singh
ID: 18008299
Have you tried adding a blank else if clause between the if and else like below?

...
else if ((win.@event.ctrlKey) && (win.@event.keyCode == (int) System.Windows.Forms.Keys.P))
{
}
...
0
 

Author Comment

by:mathieu_cupryk
ID: 18008312
u are confusing me?
0
 
LVL 18

Accepted Solution

by:
Ravi Singh earned 500 total points
ID: 18008331
this should ignore CTRL+P


case "keydown":
                    {                    
                         //MessageBox.Show(win.@event.keyCode.ToString());
                         if ((win.@event.ctrlKey) && (win.@event.keyCode == (int)System.Windows.Forms.Keys.C/*67*/))
                         {
                              DoCopy();
                         }
                         else if ((win.@event.ctrlKey) && (win.@event.keyCode == (int) System.Windows.Forms.Keys.P))
{ }
                         else
                         {
                              int keyCode = win.@event.keyCode;
                              if ((!((win.@event.ctrlKey) && ((win.@event.keyCode == (int)System.Windows.Forms.Keys.F/*70*/) || (win.@event.keyCode == (int)System.Windows.Forms.Keys.End/*35*/) || (win.@event.keyCode == (int)System.Windows.Forms.Keys.Home/*36*/)))) &&
                                   (!(win.@event.keyCode >= (int)System.Windows.Forms.Keys.PageUp/*33*/) && (win.@event.keyCode <= (int)System.Windows.Forms.Keys.Down/*40*/)) || win.@event.keyCode == (int)System.Windows.Forms.Keys.F5/*116*/)
                              {
                                   win.@event.returnValue = false;
                                   win.@event.cancelBubble = true;                              
                                   win.@event.keyCode = 0;
                              }
                         }
                         break;
                    }  
0
 

Author Comment

by:mathieu_cupryk
ID: 18008349
It is still coming up the the dialog for print.
0
 
LVL 18

Expert Comment

by:Ravi Singh
ID: 18014449
Hi, is this is a windows application or a web application? If the latter then I'm sorry I wouldn't know of a way to stop the print dialog from appearing. You might have more luck if you post this question in the ASP.NET topic area.
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question