Visual C++ and MFC Fundamentals Chapter 17: Track-Based Controls
}void CRicher1Dlg::OnBnClickedBtnItalic()
{
// TODO: Add your control notification handler code here
CHARFORMAT Cfm;m_Richer.GetSelectionCharFormat(Cfm);Cfm.cbSize = sizeof(CHARFORMAT);
Cfm.dwMask = CFM_ITALIC;
Cfm.dwEffects ^= CFE_ITALIC;m_Richer.SetSelectionCharFormat(Cfm);
m_Richer.SetFocus();
}void CRicher1Dlg::OnBnClickedBtnUnderline()
{
// TODO: Add your control notification handler code here
CHARFORMAT Cfm;m_Richer.GetSelectionCharFormat(Cfm);Cfm.cbSize = sizeof(CHARFORMAT);
Cfm.dwMask = CFM_UNDERLINE;
Cfm.dwEffects ^= CFE_UNDERLINE;m_Richer.SetSelectionCharFormat(Cfm);
m_Richer.SetFocus();
}void CRicher1Dlg::OnBnClickedBtnStrikeout()
{
// TODO: Add your control notification handler code here
CHARFORMAT Cfm;m_Richer.GetSelectionCharFormat(Cfm);Cfm.cbSize = sizeof(CHARFORMAT);
Cfm.dwMask = CFM_STRIKEOUT;
Cfm.dwEffects ^= CFE_STRIKEOUT;m_Richer.SetSelectionCharFormat(Cfm);
m_Richer.SetFocus();
}void CRicher1Dlg::OnBnClickedBtnLeft()
{
// TODO: Add your control notification handler code here
PARAFORMAT Pfm;Pfm.cbSize = sizeof(PARAFORMAT);
Pfm.dwMask = PFM_ALIGNMENT;
Pfm.wAlignment = PFA_LEFT;m_Richer.SetParaFormat(Pfm);
m_Richer.SetFocus();
}