CRichEditCtrl Font related query
-
hi all, I have a CRichEditCtrl created on CView derived class. After Creating the Rich edit control it's default font is something different than what i want. and it's bold also. so to chnge the font i am selecting all the data present in control and then applying new font to it. but when i paste the data that is not compatible with mine font again i need to select all the data and then apply font on it!! so my question is that is there any way to change the clipboard data's font so that my control will receive data in compatible font only.. or is there any way that whatever font i want my rich edit control to have i should tell it before creation as some parameter..(i think this shouls be the way:-)) means if i want that my rich edit control should have only this font say "courier new" and it is going to be fix for all it's lifetime then i should create rich edit that starts with this font only?? if anybody know's please reply.. Thanks and Regards Harshal shete
-
hi all, I have a CRichEditCtrl created on CView derived class. After Creating the Rich edit control it's default font is something different than what i want. and it's bold also. so to chnge the font i am selecting all the data present in control and then applying new font to it. but when i paste the data that is not compatible with mine font again i need to select all the data and then apply font on it!! so my question is that is there any way to change the clipboard data's font so that my control will receive data in compatible font only.. or is there any way that whatever font i want my rich edit control to have i should tell it before creation as some parameter..(i think this shouls be the way:-)) means if i want that my rich edit control should have only this font say "courier new" and it is going to be fix for all it's lifetime then i should create rich edit that starts with this font only?? if anybody know's please reply.. Thanks and Regards Harshal shete
harsha_1234 wrote:
is there any way that whatever font i want my rich edit control to have
I have solution for this..... Declare CFont *c; reference in the class . If you want if for lifetime you have to add the following code in OnInitDialog where m_pRichEdit is variable of RichEditCtrl ....
c=new CFont(); c->CreatePointFont(180,"Monotype Corsiva"); m_pRichEdit.SetEventMask(m_pRichEdit.GetEventMask() |ENM_CHANGE);
Then Just make method for RichEditControl Text Change. Write Following statement in it.GetDlgItem(IDC_RICHEDIT21)->SetFont(c);
You can take font name as parameter and provide it to the CreatePointFont method of CFont. You will get the desired output. Hope This will help you.The secret of life is not enjoyment but education through experience. - Swami Vivekananda.
-
harsha_1234 wrote:
is there any way that whatever font i want my rich edit control to have
I have solution for this..... Declare CFont *c; reference in the class . If you want if for lifetime you have to add the following code in OnInitDialog where m_pRichEdit is variable of RichEditCtrl ....
c=new CFont(); c->CreatePointFont(180,"Monotype Corsiva"); m_pRichEdit.SetEventMask(m_pRichEdit.GetEventMask() |ENM_CHANGE);
Then Just make method for RichEditControl Text Change. Write Following statement in it.GetDlgItem(IDC_RICHEDIT21)->SetFont(c);
You can take font name as parameter and provide it to the CreatePointFont method of CFont. You will get the desired output. Hope This will help you.The secret of life is not enjoyment but education through experience. - Swami Vivekananda.
Hi i Tried this it is applying the font but the boldness of the font is still there i want to disable the boldness also..
-
Hi i Tried this it is applying the font but the boldness of the font is still there i want to disable the boldness also..
For more Font Specification you can use the CreatePointFontIndirect() API. This API uses pointer of the LOGFONT.
The secret of life is not enjoyment but education through experience. - Swami Vivekananda.
-
For more Font Specification you can use the CreatePointFontIndirect() API. This API uses pointer of the LOGFONT.
The secret of life is not enjoyment but education through experience. - Swami Vivekananda.
Hey i am sorry, it's boldness is also disabled now. but now the only problem i am facing is that whenever i paste saomething in the control it's font remains same.. so i am thinking of something like this whenever user say's Paste. i will change clipboeard data's font and boldness as i want. Is this a good approach??? please Guide me as i am not very much familiar with this control Thanks and Regards Harshal
-
Hey i am sorry, it's boldness is also disabled now. but now the only problem i am facing is that whenever i paste saomething in the control it's font remains same.. so i am thinking of something like this whenever user say's Paste. i will change clipboeard data's font and boldness as i want. Is this a good approach??? please Guide me as i am not very much familiar with this control Thanks and Regards Harshal
Create a eventhandler for RicheditCtrl on EN_CHANGE Write Following statement in it.
GetDlgItem(IDC_RICHEDIT21)->SetFont(c);
This will give the desired output.The secret of life is not enjoyment but education through experience. - Swami Vivekananda.
-
Create a eventhandler for RicheditCtrl on EN_CHANGE Write Following statement in it.
GetDlgItem(IDC_RICHEDIT21)->SetFont(c);
This will give the desired output.The secret of life is not enjoyment but education through experience. - Swami Vivekananda.
Thank You very much for your help. it is working very fine. Thank's.
-
Thank You very much for your help. it is working very fine. Thank's.
But Apart from this i have another query i am doing undo redo also. it is working fine but in undo as well as redo there is one small problem that whenever i undo/redo then after every undo/redo operation it selects some text and then on next undo/redo it undoes/redoes the character that was typed. how i can fake the middle selection between two operations?? undo code is like this if (m_rich.CanUndo()) { m_rich.Undo(); } Thanks and regards Harshal