Click here to Skip to main content
15,885,074 members
Home / Discussions / C#
   

C#

 
QuestionSyntax Coloring Control For Use In A C# App Pin
Kevin Marois20-Aug-08 8:39
professionalKevin Marois20-Aug-08 8:39 
AnswerRe: Syntax Coloring Control For Use In A C# App Pin
Mark Miller20-Aug-08 9:15
Mark Miller20-Aug-08 9:15 
QuestionHelp in Key Event needed Pin
Saiyed Alam20-Aug-08 5:48
Saiyed Alam20-Aug-08 5:48 
AnswerRe: Help in Key Event needed Pin
vikas amin20-Aug-08 6:52
vikas amin20-Aug-08 6:52 
AnswerRe: Help in Key Event needed Pin
Giorgi Dalakishvili20-Aug-08 6:55
mentorGiorgi Dalakishvili20-Aug-08 6:55 
AnswerRe: Help in Key Event needed Pin
Alan N20-Aug-08 8:20
Alan N20-Aug-08 8:20 
GeneralRe: Help in Key Event needed Pin
Saiyed Alam21-Aug-08 23:39
Saiyed Alam21-Aug-08 23:39 
GeneralRe: Help in Key Event needed Pin
Alan N26-Aug-08 6:57
Alan N26-Aug-08 6:57 
Hi Saiyed,
Try this in your app.

Set the KeyPreview property of the main form to true and also set a KeyDown event handler for the main form.

With these two elements in place, the main form key handler will see all keys destined for any child control on the form so it will not matter which control has focus when the user presses Ctrl + S.

You can then test specifically for Ctrl + S as shown in the code fragment.

private void MainForm_KeyDown(object sender, KeyEventArgs e) {
  // test for keys we are interested in
  // here just the Ctrl + S combination
  if (e.KeyData == (Keys.Control | Keys.S)) {
    MessageBox.Show("Key trapped" + Environment.NewLine +
                    e.KeyData.ToString());
    // Don't pass this key combination on to any child controls
    e.SuppressKeyPress = true;
  }

}



Just insert your save method in place of the message box code.

Alan.
GeneralRe: Help in Key Event needed Pin
Saiyed Alam26-Aug-08 7:50
Saiyed Alam26-Aug-08 7:50 
QuestionChange values of pixels in an area? Pin
gigahertz20520-Aug-08 5:35
gigahertz20520-Aug-08 5:35 
AnswerRe: Change values of pixels in an area? Pin
vikas amin20-Aug-08 7:01
vikas amin20-Aug-08 7:01 
QuestionRe: Change values of pixels in an area? Pin
Mark Salsbery20-Aug-08 7:16
Mark Salsbery20-Aug-08 7:16 
AnswerRe: Change values of pixels in an area? Pin
led mike20-Aug-08 8:17
led mike20-Aug-08 8:17 
GeneralRe: Change values of pixels in an area? Pin
Mark Salsbery20-Aug-08 8:21
Mark Salsbery20-Aug-08 8:21 
AnswerRe: Change values of pixels in an area? Pin
User 665820-Aug-08 7:38
User 665820-Aug-08 7:38 
GeneralRe: Change values of pixels in an area? Pin
gigahertz20520-Aug-08 11:46
gigahertz20520-Aug-08 11:46 
GeneralRe: Change values of pixels in an area? Pin
Mark Salsbery20-Aug-08 15:40
Mark Salsbery20-Aug-08 15:40 
AnswerRe: Change values of pixels in an area? Pin
xieker20-Aug-08 16:46
xieker20-Aug-08 16:46 
AnswerRe: Change values of pixels in an area? Pin
xieker20-Aug-08 17:11
xieker20-Aug-08 17:11 
QuestionSearch not found Pin
netJP12L20-Aug-08 5:15
netJP12L20-Aug-08 5:15 
QuestionRe: Search not found Pin
led mike20-Aug-08 5:48
led mike20-Aug-08 5:48 
AnswerRe: Search not found Pin
netJP12L20-Aug-08 6:19
netJP12L20-Aug-08 6:19 
GeneralRe: Search not found Pin
led mike20-Aug-08 8:15
led mike20-Aug-08 8:15 
GeneralRe: Search not found Pin
netJP12L20-Aug-08 11:35
netJP12L20-Aug-08 11:35 
GeneralRe: Search not found Pin
led mike20-Aug-08 11:53
led mike20-Aug-08 11:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.