c++visual-studiomfc

How to draw simple box borders for static controls (no 3D effect)?


I'm using MFC with Visual Studio, and I added static controls as visual box separators in my dialog via the resource editor. In the Resource View, the left static boxes look fine with simple, flat lines (as shown in the first screenshot below).

Resource View

However, when I run the application, these static controls appear with a 3D border effect, which looks outdated and inconsistent (see the second screenshot).

Runtime View

I would prefer to keep them as clean, flat boxes — just simple lines as shown in the Resource View.

Below are also the property settings of the static control.

Property Window

What do I need to adjust to make the static controls display like simple borders — without 3D effects — at runtime?

Any help would be appreciated.

Manifest

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <dependency>
    <dependentAssembly>
      <assemblyIdentity
        type="win32"
        name="Microsoft.Windows.Common-Controls"
        version="6.0.0.0"
        processorArchitecture="*"
        publicKeyToken="6595b64144ccf1df"
        language="*" />
    </dependentAssembly>
  </dependency>
</assembly>

.RC

IDD_FORMVIEW DIALOGEX 0, 0, 259, 201
STYLE DS_SETFONT | WS_CHILD
FONT 9, "굴림", 400, 0, 0x0
BEGIN
    CONTROL         "",IDC_MFCEDITBROWSE1,"MfcEditBrowse",WS_BORDER | WS_TABSTOP | 0x80,21,71,206,14
END

IDD_EDIT_RESIZE DIALOGEX 0, 0, 312, 338
STYLE DS_SYSMODAL | DS_SETFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Image Size"
FONT 9, "굴림", 400, 0, 0x0
BEGIN
    LTEXT           "",IDC_STATIC,6,8,226,72,WS_BORDER | NOT WS_GROUP
    PUSHBUTTON      "OK",IDOK,243,12,58,19
    PUSHBUTTON      "CANCEL",IDCANCEL,243,35,58,19
    LTEXT           "Width:",IDC_STATIC,27,33,20,8
    LTEXT           "Height:",IDC_STATIC,24,57,22,9
    LTEXT           "",IDC_STATIC1,6,89,226,93,WS_BORDER | NOT WS_GROUP
    LTEXT           "Width:",IDC_STATIC,26,113,20,8
    LTEXT           "Height:",IDC_STATIC,24,135,23,8
    LTEXT           "Resolution:",IDC_STATIC,10,157,37,8
    EDITTEXT        IDC_EDIT_WIDTH,52,31,40,14,ES_AUTOHSCROLL
    EDITTEXT        IDC_EDIT_HEIGHT,52,54,40,14,ES_AUTOHSCROLL
    EDITTEXT        IDC_EDIT_SIZE_WIDTH,52,110,40,14,ES_AUTOHSCROLL
    EDITTEXT        IDC_EDIT_SIZE_HEIGHT,52,133,40,14,ES_AUTOHSCROLL
    EDITTEXT        IDC_EDIT_RESOLUTION,52,157,40,14,ES_AUTOHSCROLL
    COMBOBOX        IDC_COMBO_WIDTH,98,32,78,30,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
    COMBOBOX        IDC_COMBO_HEIGHT,98,54,79,30,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
    COMBOBOX        IDC_COMBO_SIZE_WIDTH,98,109,48,30,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
    COMBOBOX        IDC_COMBO_SIZE_HEIGHT,98,133,48,30,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
    COMBOBOX        IDC_COMBO_RESOLUTION,98,157,48,30,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
    LTEXT           "",IDC_STATIC2,7,193,226,60,WS_BORDER | NOT WS_GROUP
    LTEXT           "Format:",IDC_STATIC,21,207,24,8
    LTEXT           "Quality:",IDC_STATIC,25,228,20,8
    CONTROL         "",IDC_SPIN_QUALITY,"msctls_updown32",UDS_SETBUDDYINT | UDS_AUTOBUDDY | UDS_ARROWKEYS,94,225,9,14
    EDITTEXT        IDC_EDIT_QUALITY,54,226,40,14,ES_AUTOHSCROLL
    LTEXT           "",IDC_EDIT_RESIZE_NOTIFICATION_BOX,11,265,224,57
    LTEXT           "",IDC_EDIT_RESIZE_NOTIFICATION,19,274,205,43
    COMBOBOX        IDC_COMBO_FORMAT,54,203,48,30,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
END


Solution

  • Try to check the installed styles in the resource file .rc. There you will see descriptions of dialog boxes and controls.By default. Group box should have no effects for displaying flat lines.

    There must be something similar to this entry:

    BEGIN
        GROUPBOX        "Static",IDC_STATIC606,37,85,188,40
    END