Click here to Skip to main content
15,878,945 members
Articles / Desktop Programming / MFC

CResizableDialog

Rate me:
Please Sign up or sign in to vote.
4.85/5 (53 votes)
25 Jul 2012CPOL 807.1K   15.1K   217  
A CDialog derived class to implement resizable dialogs with MFC
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
// Italian (Italy) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ITA)
#ifdef _WIN32
LANGUAGE LANG_ITALIAN, SUBLANG_ITALIAN
#pragma code_page(1252)
#endif //_WIN32

#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//

1 TEXTINCLUDE DISCARDABLE 
BEGIN
    "resource.h\0"
END

2 TEXTINCLUDE DISCARDABLE 
BEGIN
    "#include ""afxres.h""\r\n"
    "\0"
END

3 TEXTINCLUDE DISCARDABLE 
BEGIN
    "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
    "#define _AFX_NO_OLE_RESOURCES\r\n"
    "#define _AFX_NO_TRACKER_RESOURCES\r\n"
    "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
    "\r\n"
    "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ITA)\r\n"
    "#ifdef _WIN32\r\n"
    "LANGUAGE 16, 1\r\n"
    "#pragma code_page(1252)\r\n"
    "#endif //_WIN32\r\n"
    "#include ""res\\Demo.rc2""  // non-Microsoft Visual C++ edited resources\r\n"
    "#include ""l.ita\\afxres.rc""          // Standard components\r\n"
    "#endif\r\n"
    "\0"
END

#endif    // APSTUDIO_INVOKED


/////////////////////////////////////////////////////////////////////////////
//
// Icon
//

// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDR_MAINFRAME           ICON    DISCARDABLE     "res\\Demo.ico"

/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//

IDD_DEMO_DIALOG DIALOGEX 0, 0, 160, 121
STYLE DS_MODALFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | 
    WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "CResizableDialog Demo"
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
    LTEXT           "Static text",IDC_LABEL1,7,7,87,10
    CONTROL         "Spin1",IDC_SPIN1,"msctls_updown32",UDS_ARROWKEYS | 
                    UDS_HORZ,134,7,19,10
    EDITTEXT        IDC_EDIT1,7,18,146,48,ES_MULTILINE | ES_AUTOVSCROLL | 
                    WS_VSCROLL
    CONTROL         "Hidden",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON | 
                    WS_GROUP | WS_TABSTOP,17,86,53,9
    CONTROL         "Visible",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,17,99,
                    56,9
    GROUPBOX        "Size Grip",IDC_GROUP1,7,72,87,42
    DEFPUSHBUTTON   "OK",IDOK,103,76,50,14,WS_GROUP
    PUSHBUTTON      "Cancel",IDCANCEL,103,100,50,14
END

IDD_SECOND_DIALOG DIALOG DISCARDABLE  0, 0, 186, 94
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "CResizableDialog - New features"
FONT 8, "MS Sans Serif"
BEGIN
    DEFPUSHBUTTON   "OK",IDOK,74,73,50,14
    PUSHBUTTON      "Cancel",IDCANCEL,129,73,50,14
    CONTROL         "",IDC_LINE1,"Static",SS_ETCHEDHORZ,7,66,172,1
    CONTROL         131,IDC_PICTURE1,"Static",SS_BITMAP | SS_CENTERIMAGE | 
                    SS_RIGHTJUST | SS_SUNKEN,7,7,63,52
    CONTROL         "This is about 20% with some long text",IDC_STATIC2,
                    "Static",SS_LEFTNOWORDWRAP | SS_CENTERIMAGE | SS_SUNKEN | 
                    SS_WORDELLIPSIS | WS_GROUP,142,7,37,52
    CTEXT           "This is an example of percentage resizing.\nBitmap is about 30%, this is about 50%.\n\nClick on the toolbar!",
                    IDC_STATIC1,76,7,60,52,SS_NOPREFIX | SS_SUNKEN
END


#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//

VS_VERSION_INFO VERSIONINFO
 FILEVERSION 1,0,0,2
 PRODUCTVERSION 1,0,0,2
 FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
 FILEFLAGS 0x1L
#else
 FILEFLAGS 0x0L
#endif
 FILEOS 0x4L
 FILETYPE 0x1L
 FILESUBTYPE 0x0L
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "041004B0"
        BEGIN
            VALUE "CompanyName", "\0"
            VALUE "FileDescription", "Demo Applicazione MFC\0"
            VALUE "FileVersion", "1, 0, 0, 2\0"
            VALUE "InternalName", "Demo\0"
            VALUE "LegalCopyright", "Copyright (C) 1999\0"
            VALUE "LegalTrademarks", "\0"
            VALUE "OriginalFilename", "Demo.EXE\0"
            VALUE "ProductName", "Demo Applicazione\0"
            VALUE "ProductVersion", "1, 0, 0, 2\0"
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x410, 1200
    END
END

#endif    // !_MAC


/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//

#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE 
BEGIN
    IDD_DEMO_DIALOG, DIALOG
    BEGIN
        LEFTMARGIN, 7
        RIGHTMARGIN, 153
        TOPMARGIN, 7
        BOTTOMMARGIN, 114
    END

    IDD_SECOND_DIALOG, DIALOG
    BEGIN
        LEFTMARGIN, 7
        RIGHTMARGIN, 179
        TOPMARGIN, 7
        BOTTOMMARGIN, 87
        HORZGUIDE, 59
    END
END
#endif    // APSTUDIO_INVOKED


/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//

IDB_BITMAP1             BITMAP  DISCARDABLE     "res\\bitmap1.bmp"
IDR_TOOLBAR1            BITMAP  DISCARDABLE     "res\\toolbar1.bmp"

/////////////////////////////////////////////////////////////////////////////
//
// Toolbar
//

IDR_TOOLBAR1 TOOLBAR DISCARDABLE  16, 15
BEGIN
    BUTTON      ID_BUTTON1
    BUTTON      ID_BUTTON2
    BUTTON      ID_BUTTON3
    BUTTON      ID_BUTTON4
END


/////////////////////////////////////////////////////////////////////////////
//
// String Table
//

STRINGTABLE DISCARDABLE 
BEGIN
    ID_BUTTON1              "\nuno"
    ID_BUTTON3              "\ntre"
    ID_BUTTON2              "\ndue"
    ID_BUTTON4              "\nquattro"
END

#endif    // Italian (Italy) resources
/////////////////////////////////////////////////////////////////////////////



#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ITA)
#ifdef _WIN32
LANGUAGE 16, 1
#pragma code_page(1252)
#endif //_WIN32
#include "res\Demo.rc2"  // non-Microsoft Visual C++ edited resources
#include "l.ita\afxres.rc"          // Standard components
#endif

/////////////////////////////////////////////////////////////////////////////
#endif    // not APSTUDIO_INVOKED

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Technical Lead RoboTech srl
Italy Italy
Paolo began programming at the age of 9 with a glorious Olivetti M24 (i8086) and GW-BASIC, then he played a bit with Turbo C, Turbo Pascal and Assembly (using the MS-DOS Debug). Quick BASIC and Visual Basic shortly followed, until he learned C++ in College. He tought himself MFC and Windows programming, along with some DHTML and Javascript.

Always attracted by low-level programming and Assembly, he started to appreciate the joys of templates and STL while working for his Master Thesis. For seven months he was playing with airplanes and automatic control at the Unversity of Illinois at Urbana-Champaign, where he first met QNX and embedded systems.

In his job experience he learned Java to develop user interfaces and graphical editors, and re-discovered the Eclipse IDE that he had used in its early versions with the QNX SDK. He also deepened his knowledge of Linux and embedded systems, microcontrollers firmware and embedded voice recognition, while also practicing electronics design.

He graduated in Computer Engineering (Ingegneria informatica) at the University of Pisa, Italy, in December 2003. Currently working for an electronics and robotics company (www.robotechsrl.com).

He lives in Pisa and in Follonica (GR), Italy.

Comments and Discussions