vc中关于rich edit字体设置
我在richedit中选定一段文字,然后用SetSelectionCharFormat函数改变其字体,但是会出现一个断言,这是怎么回事?...
我在rich edit中选定一段文字,然后用SetSelectionCharFormat函数改变其字体,但是会出现一个断言,这是怎么回事?
展开
1个回答
展开全部
// The pointer to my rich edit control.
extern CRichEditCtrl* pmyRichEditCtrl;
CHARFORMAT cf;
// Modify the selection format so that the selected text is
// displayed in bold and not striked out.
cf.dwMask = CFM_STRIKEOUT|CFM_BOLD;
cf.dwEffects = CFE_BOLD;
pmyRichEditCtrl->SetSelectionCharFormat(cf);
// Verify the settings are what is expected.
#ifdef _DEBUG
pmyRichEditCtrl->GetSelectionCharFormat(cf);
ASSERT((cf.dwMask&(CFM_STRIKEOUT|CFM_BOLD)) ==
(CFM_STRIKEOUT|CFM_BOLD));
ASSERT((cf.dwEffects&(CFE_STRIKEOUT|CFE_BOLD)) == CFE_BOLD);
#endif
这个是MSDN中的示例,看看是否有帮助。
extern CRichEditCtrl* pmyRichEditCtrl;
CHARFORMAT cf;
// Modify the selection format so that the selected text is
// displayed in bold and not striked out.
cf.dwMask = CFM_STRIKEOUT|CFM_BOLD;
cf.dwEffects = CFE_BOLD;
pmyRichEditCtrl->SetSelectionCharFormat(cf);
// Verify the settings are what is expected.
#ifdef _DEBUG
pmyRichEditCtrl->GetSelectionCharFormat(cf);
ASSERT((cf.dwMask&(CFM_STRIKEOUT|CFM_BOLD)) ==
(CFM_STRIKEOUT|CFM_BOLD));
ASSERT((cf.dwEffects&(CFE_STRIKEOUT|CFE_BOLD)) == CFE_BOLD);
#endif
这个是MSDN中的示例,看看是否有帮助。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询