如何更改编辑控件的字体颜色和字体属性(斜体/粗体) [英] How to to change font color and font attributes (italic / bold) of the edit control

查看:144
本文介绍了如何更改编辑控件的字体颜色和字体属性(斜体/粗体)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI,

i有一个编辑控件,我想将编辑控件字体的文本更改为斜体。

i能够设置字体颜色但不是字体属性工作

你能建议我怎么换这个



我尝试过的事情:



HI ,
i have an edit control and i want to change the text of edit control font to italic.
i am able to chnage the font color but font attributes not working
could you please suggest me how to change this

What I have tried:

void TestDlg::OnBnClickedDefaultRadio()
{
    // TODO: Add your control notification handler code here
    m_editControl.SetWindowText(_T("50"));// here m_edit control is myedit class object and my edit class is inherited from CEdit
    m_editControl.SetTextColor(BLUE);

    CFont m_Font;
    // m_Font.Detach();)
    if (m_Font.CreateFont(-13, 0, 0, 0, FW_LIGHT, TRUE, TRUE, 0, 0, 0, 0, 0, 0, L"Arial") )
    {
       // GetDlgItem(IDC_EDIT1)->SetFont(&m_Font);
        m_editControl.SetFont(&m_Font);
    }

}

推荐答案

请参阅解决方案1 ​​如何更改CEdit Control的字体? [ ^ ]。
See Solution 1 at how to change font of CEdit Control?[^].


这篇关于如何更改编辑控件的字体颜色和字体属性(斜体/粗体)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆