James T Gray

Ooook, here's what I've got so far:

  • Program: Windows Forms created using Visual C++ 2005 EE Visual Designer
  • Basic Menu Strip, Toolbar (Standard Buttons: Cut, Paste, Bold, Font Size, etc), Status Strip, etc.
  • TabControl: Each tab listed in the control has a different function of 2 primary types [WebBrowser/RichTextBox]
  • WebBrowsers act like IE by changing the shown buttons on the afformentioned Toolbar to buttons for Back, Forward, Address (Url), blah blah blah
  • RichTextBoxes act like Wordpad by changing the shown buttons on the afformentioned Toolbar to buttons for word processing such as New, Open, Save, Email, Print, Page Setup, Bold, Italic, Underline, Font face (eg- "Calibri"), Font Color, Font Size and a couple other parsing functions specific to the job I'm doing

Here's where I'm having troubles:

  1. Changing Font Face & Size of SelectedText
    • If multiple fonts are inside same Selected Text of the RichTextBox, it throws an exception that the SelectionFont->FontFamily is not set to an instance of an object
    • If I select only the portion that is the other font (of two fonts) and change it individually to the main font then reselect the entire section I can change it all at once, no problems
    • I have "try/catch" handlers in place to keep the entire program from crashing
    • I am attempting to rewrite the present code to allow it to iterate through every character in the SelectedText, but I lose the SelectionFont functionaliy to change the font or Size to what I want so basically I can't do it
    • Anyone know a workaround
  2. Bold/Italic/Underline -ing SelectedText
    • I can change one to another and make it more than one of the 3 functions at the same time but say I'm selecting a range of text that includes both underline and not underlined text, if I click Bold it will make the whole thing either underlined and Bold or just Bold (depending on where I selected the text)
    • I am attempting to rewrite the present code to allow it to iterate through every character in the SelectedText, but I lose the SelectionFont functionaliy to change the font or Size to what I want so basically I can't do it (almost same issue as above)

Thanks in advance for any and all suggestions!



Re: Visual C++ Express Edition RichTextBox's and their fun (VC++/CLI)

nobugz

You are not going to attract any answers with a thread like this. Be sure to ask only one question. Show a code snippet that shows what you've tried to do. Explain what you've tried to make it work.





Re: Visual C++ Express Edition RichTextBox's and their fun (VC++/CLI)

James T Gray

Edited the above (removed Printing question)

I may have been able to partially answer my own question on the formatting though it still seems to be a bit off:

Edit:

I answered my own question, it's not perfect but it works