|
-
September 27th, 2003, 10:35 AM
#1
Need help with CRichEditCtrl (Please)...
I have tried everything ... read the MSDN, about this, I have read almost all the articles I could find on setting text bold in a rich edit control ...
Ok what happens is as follows ....
CHARFORMAT2 chfFmt;
m_RichEditCtrl.SetSel(0, 5);
chfFmt.dwMask = CFM_BOLD;
chfFmt.dwEffects = CFE_BOLD;
m_RichEditCtrl.SetSelectionCharFormat(chfFmt);
<- this will result in
HERE IS MY TEXT IN MY TEXTBOX
The first few characters are now bold ...
Now I try doing this ...
CHARFORMAT2 chfFmt;
m_RichEditCtrl.SetSel(0, 5);
chfFmt.dwMask = 0;
chfFmt.dwEffects = 0;
m_RichEditCtrl.SetSelectionCharFormat(chfFmt);
but the result is that the BOLD text did not return back to normal text it still gives me
HERE IS MY TEXT IN MY TEXTBOX
How do I remove bold text, when it was normal, and setting it back to normal, to actually go back to normal, or "unbold" the characters ... ?
Thanx in advance ...
xIRC
-
September 27th, 2003, 12:02 PM
#2
Re: Need help with CRichEditCtrl (Please)...
Originally posted by xIRC
chfFmt.dwMask = 0;
chfFmt.dwEffects = 0;
The problem is here. By setting dwEffects to 0, you tell SetSelectionCharFormat() that you want to remove any styles like bold, italic etc, which is OK. However, by setting dwMask to 0, you say at the same time that you don't intend to influence any of those effects. So in order to set or remove the bold flag in dwEffects, you always have to set dwMask to a value including at least CFM_BOLD.
-
September 28th, 2003, 07:07 AM
#3
Thank you !!!
Thanks for all your help I've received so far from gstercken ... 
And thank you all as well for also helping me, when I get stuck or someting 
See around ... hehe !
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|