EditBox Control and font size
2006-10-17 21:54
357 查看
http://forums.devx.com/showthread.php?t=83993
I'm very confus Re: EditBox Control and font size, color, etc...
Hello boris,
I don't know what to do with all that. Actually I'm working under VC++, and
I have a dialogBox in which i want to change the font size and color of on
Edit Box (CEdit) suppose IDC_EDIT1. I don't know how to put all this stuff
together to obtain what I want.. Can you give me some clue.
Demo
"Boris Karadjov" <bbmvp@cpppp.virtualave.net> wrote:
>To change the font size and face, use CWnd::SetFont (MFC) or WM_SETFONT
>(Win32 API).
>To change the color, override OnCtlColor(..., CTLCOLOR_EDIT) in your dialog
>class to use CDC::SetTextColor (MFC) or handle WM_CTCOLOREDIT message and
>call ::SetTextColor function (Win32 API).
>--
>Boris Karadjov
>Brainbench MVP for Visual C++
>http://www.brainbench.com
>
>"Demo" <denis@cybercat.qc.ca> wrote in message
>news:3b32bd09$1@news.devx.com...
>>
>> hello everybody,
>>
>> I'm looking for a way to change the font size, color, etc... of one
>editBox
>> in my dialog windows. I'm pretty sure I can do this, but how????
>>
>>
>> Is somebody can help me...
>>
>> Demo
>
>
I'm very confus Re: EditBox Control and font size, color, etc...
Hello boris,
I don't know what to do with all that. Actually I'm working under VC++, and
I have a dialogBox in which i want to change the font size and color of on
Edit Box (CEdit) suppose IDC_EDIT1. I don't know how to put all this stuff
together to obtain what I want.. Can you give me some clue.
Demo
"Boris Karadjov" <bbmvp@cpppp.virtualave.net> wrote:
>To change the font size and face, use CWnd::SetFont (MFC) or WM_SETFONT
>(Win32 API).
>To change the color, override OnCtlColor(..., CTLCOLOR_EDIT) in your dialog
>class to use CDC::SetTextColor (MFC) or handle WM_CTCOLOREDIT message and
>call ::SetTextColor function (Win32 API).
>--
>Boris Karadjov
>Brainbench MVP for Visual C++
>http://www.brainbench.com
>
>"Demo" <denis@cybercat.qc.ca> wrote in message
>news:3b32bd09$1@news.devx.com...
>>
>> hello everybody,
>>
>> I'm looking for a way to change the font size, color, etc... of one
>editBox
>> in my dialog windows. I'm pretty sure I can do this, but how????
>>
>>
>> Is somebody can help me...
>>
>> Demo
>
>
#2 06-22-2001, 02:50 PM | |||
| |||
Re: I'm very confus Re: EditBox Control and font size, color, etc... OK. Let's assume you are writing a MFC application and the class for the dialog containing the edit control you want to set font and text color of is called CMyDialog. Using Class Wizard add handlers for WM_INITDIALOG and WM_CTLCOLOR messages as follows: BOOL CMyDialog::OnInitDialog() { CDialog::OnInitDialog(); CFont fnt; fnt.CreateFont(14, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, "Comic Sans MS"); GetDlgItem(IDC_EDIT1)->SetFont(&fnt); fnt.Detach(); return TRUE; } HBRUSH CMyDialog::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); if (nCtlColor == CTLCOLOR_EDIT && pWnd->GetDlgCtrlID() == IDC_EDIT1) pDC->SetTextColor(RGB(128, 0, 128)); return hbr; } Hope this makes more sense. -- Boris Karadjov Brainbench MVP for Visual C++ http://www.brainbench.com "Demo" <denis@cybercat.qc.ca> wrote in message news:3b337f0e$1@news.devx.com... > > Hello boris, > > I don't know what to do with all that. Actually I'm working under VC++, and > I have a dialogBox in which i want to change the font size and color of on > Edit Box (CEdit) suppose IDC_EDIT1. I don't know how to put all this stuff > together to obtain what I want.. Can you give me some clue. > > Demo > > "Boris Karadjov" <bbmvp@cpppp.virtualave.net> wrote: > >To change the font size and face, use CWnd::SetFont (MFC) or WM_SETFONT > >(Win32 API). > >To change the color, override OnCtlColor(..., CTLCOLOR_EDIT) in your dialog > >class to use CDC::SetTextColor (MFC) or handle WM_CTCOLOREDIT message and > >call ::SetTextColor function (Win32 API). > >-- > >Boris Karadjov > >Brainbench MVP for Visual C++ > >http://www.brainbench.com > > > >"Demo" <denis@cybercat.qc.ca> wrote in message > >news:3b32bd09$1@news.devx.com... > >> > >> hello everybody, > >> > >> I'm looking for a way to change the font size, color, etc... of one > >editBox > >> in my dialog windows. I'm pretty sure I can do this, but how???? > >> > >> > >> Is somebody can help me... > >> > >> Demo > > > > > |
相关文章推荐
- 翻译:A Picturebox Control to Display Both Remote Sensing and Regular Digital Images
- 在网页中使用Winform控件,并调整其大小(using Winform control in ASP.NET and adjust its size)
- C#数值编辑控件TNumEditBox(C# Numerical/Decimal Edit Control)
- Its width is W and height is H. As a result, if the font size of characters is S then it can only sh
- TDateEditPicker: A Nullable & Bindingable Date Edit and Pick Control
- Customized Report List Control with In-Place Combo Box '& Edit Control
- MFC控件使用说明(combo box Button Check Box Radio Button List Control Edit Box Hot Key IP Address....)
- Set font size and color in GUI.Label
- cocos2dx 控件学习EditBox TableView ControlSlider ScrollView
- Calculating The Logical Height and Point Size of a Font
- Android EditText with custom font and clear button
- Unity3D GUISkin Font(ttf) 导致的:“Font size and style overrides are only supported for dynamic fonts.
- Edit Control with Icon and Background Text
- About how to use Edit Control and SPin Control together! (关于怎么组合使用Edit Control 和 Spin Control 增加浮点数)
- Calculating The Logical Height and Point Size of a Font
- Customized Report List Control With In Place Combo Box & Edit Control
- Use the DataList Control to Present and Edit Data...
- 如何改变控件的颜色(EditBox and Static)
- cocos2d-x 常用代码、高频使用代码【CCLayer、CCEditBox编辑框、CCControlButton按钮、CCLabelTTF标签、CCSpriteBatchNode渲染、CCMen】
- MFC控件使用说明(combo box Button Check Box Radio Button List Control Edit Box Hot Key IP Address....)