Click here to Skip to main content
15,929,025 members
Home / Discussions / C#
   

C#

 
AnswerThanks Was: Listbox and contextmenu Pin
iakob29-Nov-06 20:34
iakob29-Nov-06 20:34 
QuestionRichTextBox Coloring Problem Pin
NaNg1524129-Nov-06 9:02
NaNg1524129-Nov-06 9:02 
AnswerRe: RichTextBox Coloring Problem Pin
Torsten Mauz29-Nov-06 9:31
Torsten Mauz29-Nov-06 9:31 
GeneralRe: RichTextBox Coloring Problem Pin
NaNg1524129-Nov-06 9:46
NaNg1524129-Nov-06 9:46 
QuestionEditing all GridView Rows Pin
Abbas8229-Nov-06 8:52
Abbas8229-Nov-06 8:52 
AnswerRe: Editing all GridView Rows Pin
led mike29-Nov-06 9:15
led mike29-Nov-06 9:15 
GeneralRe: Editing all GridView Rows Pin
Abbas8229-Nov-06 11:12
Abbas8229-Nov-06 11:12 
QuestionRichTextBox quandry Pin
Vodstok29-Nov-06 8:38
Vodstok29-Nov-06 8:38 
I have never been able to figure this oneout, or find anything that reliably worked, either.

i am trying to develope an app that uses a richtextbox for input, and has all the options that wordpad does. Now, i realise i may not be able to pull off each and every trick, but there is one in particular that is driving me crazy. in wirdpad, say I have this sentance:

Bold and Italic are font styles.

Now, something i can do very easily is switch individual selections back and forth between one font style and another, so this would be easy:

Bold and Italic are font styles.

the problem is, if i want to do this:

Bold and Italic are font styles.

i get one or the other, basically whichever i selected last. here is the code i am using. rtb is the RichTextBox:

 private void btnBold_Click(object sender, EventArgs e)<br />
        {<br />
            if (rtb.SelectionFont.Bold)<br />
                rtb.SelectionFont = new Font(rtb.SelectionFont.FontFamily, rtb.SelectionFont.Size, FontStyle.Regular);<br />
            else<br />
                rtb.SelectionFont = new Font(rtb.SelectionFont.FontFamily, rtb.SelectionFont.Size, FontStyle.Bold);<br />
            rtb.Select();<br />
        }<br />
<br />
        private void btnItal_Click(object sender, EventArgs e)<br />
        {<br />
            if (rtb.SelectionFont.Italic)<br />
                rtb.SelectionFont = new Font(rtb.SelectionFont.FontFamily, rtb.SelectionFont.Size, FontStyle.Regular);<br />
            else<br />
                rtb.SelectionFont = new Font(rtb.SelectionFont.FontFamily, rtb.SelectionFont.Size, FontStyle.Italic);<br />
            rtb.Select();<br />
        }


I am using C# express and the 2.0 framework. Any ideas?



______________________
Mr Griffin, eleventy billion is not a number...WTF | :WTF:

AnswerRe: RichTextBox quandry Pin
NaNg1524129-Nov-06 9:04
NaNg1524129-Nov-06 9:04 
GeneralRe: RichTextBox quandry Pin
Vodstok29-Nov-06 9:34
Vodstok29-Nov-06 9:34 
AnswerRe: RichTextBox quandry Pin
Anthony Queen29-Nov-06 9:57
Anthony Queen29-Nov-06 9:57 
GeneralRe: RichTextBox quandry Pin
Vodstok29-Nov-06 10:16
Vodstok29-Nov-06 10:16 
GeneralRe: RichTextBox quandry Pin
Anthony Queen29-Nov-06 10:23
Anthony Queen29-Nov-06 10:23 
QuestionDataTable & DataView Pin
Mohammed Elkholy29-Nov-06 7:40
Mohammed Elkholy29-Nov-06 7:40 
AnswerRe: DataTable & DataView Pin
ednrgc29-Nov-06 8:40
ednrgc29-Nov-06 8:40 
GeneralRe: DataTable & DataView Pin
Mohammed Elkholy29-Nov-06 9:01
Mohammed Elkholy29-Nov-06 9:01 
GeneralRe: DataTable & DataView Pin
Stathread29-Nov-06 9:56
Stathread29-Nov-06 9:56 
QuestionLocalization of data Pin
Herhighness29-Nov-06 7:24
Herhighness29-Nov-06 7:24 
AnswerRe: Localization of data Pin
dead_link29-Nov-06 8:10
dead_link29-Nov-06 8:10 
QuestionStrange reaction from a DataGridView Pin
~~~Johnny~~~29-Nov-06 7:05
~~~Johnny~~~29-Nov-06 7:05 
QuestionXmlDocument - Browser View Pin
h@s@n29-Nov-06 6:46
h@s@n29-Nov-06 6:46 
QuestionRe: XmlDocument - Browser View Pin
loneferret29-Nov-06 7:29
loneferret29-Nov-06 7:29 
AnswerRe: XmlDocument - Browser View Pin
h@s@n29-Nov-06 7:46
h@s@n29-Nov-06 7:46 
QuestionGet Current Process Pin
Now_Loading29-Nov-06 5:59
Now_Loading29-Nov-06 5:59 
AnswerRe: Get Current Process Pin
Eric Dahlvang29-Nov-06 6:45
Eric Dahlvang29-Nov-06 6:45 

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.