SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftMask/OCX 7.0 - Masked Edit Control
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftPrintPreview/DLL 2.0 - Print Preview Control (discontinued)
SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftDirectory 3.5 - File/Folder Control (discontinued)
SftMask/OCX 7.0 - Masked Edit Control
SftOptions 1.0 - Registry/INI Control (discontinued)
SftPrintPreview/OCX 1.0 - Print Preview Control (discontinued)
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftTabs/NET 6.0 - Tab Control (discontinued)
SftTree/NET 2.0 - Tree Control
This sample illustrates button states and images.
The source code is located at C:\Program Files (x86)\Softelvdm\SftButton OCX 3.0\Samples\VC++\Images\ImagesDlg.cpp or C:\Program Files\Softelvdm\SftButton OCX 3.0\Samples\VC++\Images\ImagesDlg.cpp (on 32-bit Windows versions).
// ImagesDlg.cpp : implementation file // #include "stdafx.h" #include "Images.h" #include "ImagesDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CImagesDlg dialog CImagesDlg::CImagesDlg(CWnd* pParent /*=NULL*/) : CDialog(CImagesDlg::IDD, pParent) { //{{AFX_DATA_INIT(CImagesDlg) //}}AFX_DATA_INIT // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); } void CImagesDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CImagesDlg) DDX_Control(pDX, IDC_TITLE, m_CtlTitle); DDX_Control(pDX, IDC_CHECK2, m_CtlCheck2); DDX_Control(pDX, IDC_CHECK1, m_CtlCheck1); DDX_Control(pDX, IDC_CLOSEBUTTON, m_CtlCloseButton); DDX_Control(pDX, IDC_SFTBTN1, m_CtlButton1); DDX_Control(pDX, IDC_SFTBTN2, m_CtlButton2); DDX_Control(pDX, IDC_SFTBUTTONCHECK, m_CtlSftButtonCheck); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CImagesDlg, CDialog) //{{AFX_MSG_MAP(CImagesDlg) ON_WM_PAINT() ON_WM_QUERYDRAGICON() ON_BN_CLICKED(IDC_CHECK1, OnCheck1) ON_BN_CLICKED(IDC_CHECK2, OnCheck2) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CImagesDlg message handlers BOOL CImagesDlg::OnInitDialog() { CDialog::OnInitDialog(); // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon // Make a bold font for the dialog title CFont* pFont = GetFont(); // get dialog font LOGFONT lf; pFont->GetLogFont(&lf); lf.lfWeight += (FW_BOLD-FW_NORMAL); m_BoldFont.CreateFontIndirect(&lf); m_CtlTitle.SetFont(&m_BoldFont); // Get all ISftButton interface pointers for access to all // properties and methods (see Using SftButton/OCX with Visual C++ // in the online help for more information) m_vButton1 = m_CtlButton1.GetControlUnknown(); m_vButton2 = m_CtlButton2.GetControlUnknown(); m_vButtonCheck = m_CtlSftButtonCheck.GetControlUnknown(); m_vCloseButton = m_CtlCloseButton.GetControlUnknown(); // save the button size to demonstrate auto-sizing m_CtlButton2.GetClientRect(&m_savedRect); m_CtlButton2.MapWindowPoints(this, &m_savedRect); // initialize a SftButton control to look like a check box m_vButtonCheck->BorderAlways = VARIANT_FALSE; m_vButtonCheck->AutoSize = autosizeSftButtonLeftCenter; m_vButtonCheck->Bounce = bounceSftButtonNo; m_vButtonCheck->ButtonStyle = styleSftButtonNone; m_vButtonCheck->ClickStyle = clickstyleSftButtonPictures; m_vButtonCheck->HoverStyle = hoverstyleSftButtonExact; m_vButtonCheck->Image1->Appearance = sftImageCheckboxYes; m_vButtonCheck->Text = "A SftButton control that looks like a check box with a caption"; m_vButtonCheck->ShowFocus = VARIANT_FALSE; return TRUE; // return TRUE unless you set the focus to a control } // If you add a minimize button to your dialog, you will need the code below // to draw the icon. For MFC applications using the document/view model, // this is automatically done for you by the framework. void CImagesDlg::OnPaint() { if (IsIconic()) { CPaintDC dc(this); // device context for painting SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); // Center icon in client rectangle int cxIcon = GetSystemMetrics(SM_CXICON); int cyIcon = GetSystemMetrics(SM_CYICON); CRect rect; GetClientRect(&rect); int x = (rect.Width() - cxIcon + 1) / 2; int y = (rect.Height() - cyIcon + 1) / 2; // Draw the icon dc.DrawIcon(x, y, m_hIcon); } else { CDialog::OnPaint(); } } // The system calls this to obtain the cursor to display while the user drags // the minimized window. HCURSOR CImagesDlg::OnQueryDragIcon() { return (HCURSOR) m_hIcon; } void CImagesDlg::OnCheck1() { // enable/disable the control so the image changes m_CtlButton1.EnableWindow(!m_CtlCheck1.GetCheck()); } void CImagesDlg::OnCheck2() { // resize the control if (m_CtlCheck2.GetCheck()) { m_vButton2->AutoSize = autosizeSftButtonLeftCenter; } else { m_vButton2->AutoSize = autosizeSftButtonNone; m_CtlButton2.MoveWindow(&m_savedRect, TRUE); } } void CImagesDlg::OnClickClosebutton() { EndDialog(IDOK); } void CImagesDlg::OnClickSftbuttonCheck() { // toggle the check box if (m_vButtonCheck->Image1->Appearance == sftImageCheckboxYes) m_vButtonCheck->Image1->Appearance = sftImageCheckboxNo; else m_vButtonCheck->Image1->Appearance = sftImageCheckboxYes; } void CImagesDlg::OnDblClickSftbuttonCheck() { OnClickSftbuttonCheck(); } BEGIN_EVENTSINK_MAP(CImagesDlg, CDialog) //{{AFX_EVENTSINK_MAP(CImagesDlg) ON_EVENT(CImagesDlg, IDC_CLOSEBUTTON, 2 /* Click */, OnClickClosebutton, VTS_NONE) ON_EVENT(CImagesDlg, IDC_SFTBUTTONCHECK, 2 /* Click */, OnClickSftbuttonCheck, VTS_NONE) ON_EVENT(CImagesDlg, IDC_SFTBUTTONCHECK, 3 /* DblClick */, OnDblClickSftbuttonCheck, VTS_NONE) //}}AFX_EVENTSINK_MAP END_EVENTSINK_MAP()