Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Need to add to the following  avoid ctrl + p:

Posted on 2006-11-24
5
Medium Priority
?
213 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 2000 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

636 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