Click here to Skip to main content
15,905,238 members
Home / Discussions / C#
   

C#

 
AnswerRe: How do I change service startup type Pin
Sunil G11-May-10 23:07
Sunil G11-May-10 23:07 
QuestionWindowStartPosition Pin
gmhanna11-May-10 5:32
gmhanna11-May-10 5:32 
AnswerRe: WindowStartPosition Pin
William Winner11-May-10 5:55
William Winner11-May-10 5:55 
AnswerRe: WindowStartPosition Pin
Luc Pattyn11-May-10 6:17
sitebuilderLuc Pattyn11-May-10 6:17 
QuestionCTRL/I within a RichTextBox Pin
gmhanna11-May-10 5:22
gmhanna11-May-10 5:22 
AnswerRe: CTRL/I within a RichTextBox [modified] Pin
William Winner11-May-10 6:00
William Winner11-May-10 6:00 
GeneralRe: CTRL/I within a RichTextBox Pin
gmhanna11-May-10 8:34
gmhanna11-May-10 8:34 
GeneralRe: CTRL/I within a RichTextBox Pin
William Winner11-May-10 9:01
William Winner11-May-10 9:01 
Well, as I said, you would have to use the SuppressKeyPreview value within the Keydown code. Though what I found was that sometimes, it didn't work. For instance, if I set SuppressKeyPreview to true and then did a MessageBox, it went ahead and erased the line.

This was the code that I got to work:
C#
private void richTextBox1_KeyDown(object sender, KeyEventArgs e)
{
    if (e.Control && e.KeyCode == Keys.I)
    {
        e.SuppressKeyPress = true;
        e.Handled = true;

        SetItalic();
    }
}

private void SetItalic()
{
    if (richTextBox1.SelectionFont.Italic)
    {
        richTextBox1.SelectionFont = new Font(richTextBox1.Font, FontStyle.Regular);
    }
    else
    {
        richTextBox1.SelectionFont = new Font(richTextBox1.Font, FontStyle.Italic);
    }
}


This code toggled Italic without erasing anything.
GeneralRe: CTRL/I within a RichTextBox Pin
gmhanna11-May-10 9:20
gmhanna11-May-10 9:20 
AnswerRe: CTRL/I within a RichTextBox Pin
Luc Pattyn11-May-10 6:19
sitebuilderLuc Pattyn11-May-10 6:19 
QuestionSet page range in PrintPreview Pin
baranils11-May-10 5:18
baranils11-May-10 5:18 
QuestionMaximum number of lines within a class Pin
Tony Pazzard11-May-10 4:44
Tony Pazzard11-May-10 4:44 
AnswerRe: Maximum number of lines within a class Pin
Luc Pattyn11-May-10 4:50
sitebuilderLuc Pattyn11-May-10 4:50 
AnswerRe: Maximum number of lines within a class Pin
#realJSOP11-May-10 6:36
professional#realJSOP11-May-10 6:36 
AnswerRe: Maximum number of lines within a class Pin
The Man from U.N.C.L.E.11-May-10 7:42
The Man from U.N.C.L.E.11-May-10 7:42 
AnswerRe: Maximum number of lines within a class Pin
PIEBALDconsult11-May-10 7:51
mvePIEBALDconsult11-May-10 7:51 
GeneralRe: Maximum number of lines within a class Pin
Luc Pattyn11-May-10 7:58
sitebuilderLuc Pattyn11-May-10 7:58 
GeneralRe: Maximum number of lines within a class Pin
PIEBALDconsult11-May-10 15:21
mvePIEBALDconsult11-May-10 15:21 
GeneralRe: Maximum number of lines within a class Pin
Luc Pattyn11-May-10 15:39
sitebuilderLuc Pattyn11-May-10 15:39 
AnswerRe: Maximum number of lines within a class Pin
Abhinav S11-May-10 7:52
Abhinav S11-May-10 7:52 
AnswerRe: Maximum number of lines within a class Pin
Bernhard Hiller12-May-10 3:56
Bernhard Hiller12-May-10 3:56 
Questionsn.exe, public key question Pin
Ryan Minor11-May-10 4:28
Ryan Minor11-May-10 4:28 
AnswerRe: sn.exe, public key question Pin
Peace ON11-May-10 4:49
Peace ON11-May-10 4:49 
QuestionUnknown connection option in connection string: provider. Pin
Tunisien8611-May-10 2:58
Tunisien8611-May-10 2:58 
AnswerRe: Unknown connection option in connection string: provider. Pin
dan!sh 11-May-10 3:26
professional dan!sh 11-May-10 3:26 

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.