그룹박스의 테두리및 글씨를 보기 좋게....
If you want to customize the look of the standard GroupBox control then the SxGroupBox class can be most helpful for you. It provides functions for customizing the font, color, and style. Most of the work is done in the OnPaint message handler. You can easily change the OnPaint function yourself to add other effects such as rounded corners or other line styles or box styles.
You can follow these steps to use the class:
- Include the SxGroupBox.h header file in your dialog class header file.
- Use class wizard to create a control data member of type CSxGroupBox. If the CSxGroupBox type does not appear in the class wizard control type combobox then just choose CButton and then manually edit your dialog class header file and replace the CButton with CSxGroupBox.
- Add whatever commands you want to your dialog class cpp file to customize the appearance of the GroupBox.
A sample application is included that shows most of the features of SxGroupBox.
The following code snippet shows how to call some of the functions.
[In File YourDialogClass.h]
- #include "SxGroupBox.h"
- class YourDialogClass : public CDialog
- {
- ...
- // Dialog Data
- //{{AFX_DATA(YourDialogClass)
- ...
- CSxGroupBox MyGroupBox;
- ...
- //}}AFX_DATA
- ...
- }
[In File YourDialogClass.cpp]
- void YourDialogClass::YourFunction()
- {
- // create font
- CSxLogFont Arial12b(120,FW_BOLD,false,"Arial");
- // set the custom font, text color, and alignment
- MyGroupBox.SetFont( &Arial12b );
- MyGroupBox.SetTextColor( RGB(100,0,0) );
- MyGroupBox.SetTextAlign( BS_CENTER );
- // set the custom line colors, thickness, and style
- MyGroupBox.SetBoxColors( RGB(100,0,0), RGB(255,100,100) );
- MyGroupBox.SetLineThickness(2);
- MyGroupBox.SetLineStyle( BS_3D );
- }
'개발 > MFC' 카테고리의 다른 글
[스크랩]실시간 그래프 (1) | 2017.06.20 |
---|---|
Warning C4996 (0) | 2017.04.28 |
MFC 타이틀바 없앤뒤 이동하기 (0) | 2017.04.28 |
MFC 타이틀바 없애기 (0) | 2017.04.28 |
MFC 테두리 없애기 (0) | 2017.04.28 |
MFC 다이얼로그 접기 펴기 (0) | 2017.04.24 |
MFC 에디트 컨트롤 색상 (0) | 2017.04.21 |
MFC 윈도우 스타일 적용 (0) | 2017.04.21 |