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 setting design-time properties at run-time.
The source code is located at C:\Program Files (x86)\Softelvdm\SftButton OCX 3.0\Samples\VC++\Runtime\RuntimeDlg.cpp or C:\Program Files\Softelvdm\SftButton OCX 3.0\Samples\VC++\Runtime\RuntimeDlg.cpp (on 32-bit Windows versions).
// RuntimeDlg.cpp : implementation file // #include "stdafx.h" #include "Runtime.h" #include "RuntimeDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CRuntimeDlg dialog CRuntimeDlg::CRuntimeDlg(CWnd* pParent /*=NULL*/) : CDialog(CRuntimeDlg::IDD, pParent) { //{{AFX_DATA_INIT(CRuntimeDlg) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); } void CRuntimeDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CRuntimeDlg) DDX_Control(pDX, IDC_SFTBTN1, m_Button1); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CRuntimeDlg, CDialog) //{{AFX_MSG_MAP(CRuntimeDlg) ON_WM_PAINT() ON_WM_QUERYDRAGICON() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CRuntimeDlg message handlers BOOL CRuntimeDlg::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 // This sample doesn't do anything "useful". Its only purpose // is to provide runtime initialization of a SftButton control, // so we have some code samples for the properties. // It is a lot easier to set properties at design-time using // the property pages. Right-click on the control, then select // "Properties" from the popup menu to access the property pages. m_vButton = m_Button1.GetControlUnknown(); // Appearance m_vButton->put_AVITransparent(VARIANT_TRUE); m_vButton->put_BorderAlways(VARIANT_TRUE); m_vButton->put_BorderStyle(borderSftButtonStandard); m_vButton->put_ButtonStyle(styleSftButtonDropDown); m_vButton->put_DropDownPressed(VARIANT_FALSE); m_vButton->put_DropDownStyle(dropdownstyleSftButtonStandard); m_vButton->put_FillOrientation(orientationSftButtonHorizontal); m_vButton->put_Orientation(orientationSftButtonHorizontal); m_vButton->put_Pressed(VARIANT_FALSE); m_vButton->put_ShowFocus(VARIANT_TRUE); m_vButton->put_Text(_bstr_t(_T("Code Sample"))); m_vButton->put_TextAlignHorz(alignSftButtonCenter); m_vButton->put_TextAlignVert(alignSftButtonVCenter); m_vButton->put_UseThemes(themesSftButtonNo); // Behavior m_vButton->put_AllowFocus(VARIANT_TRUE); m_vButton->put_Bounce(bounceSftButtonYes); m_vButton->put_ClickInterval(100); m_vButton->put_DropDownDownClick(VARIANT_TRUE); m_vButton->put_DropDownFollows(VARIANT_FALSE); m_vButton->put_DropDownPressed(VARIANT_FALSE); m_vButton->put_DropDownToggle(VARIANT_FALSE); m_vButton->put_Enabled(VARIANT_TRUE); m_vButton->put_Follows(VARIANT_FALSE); m_vButton->put_OLEDragMode(OLEDragSftButtonNone); m_vButton->put_OLEDropMode(OLEDropSftButtonNone); m_vButton->put_RightToLeft(VARIANT_FALSE); m_vButton->put_Toggle(VARIANT_FALSE); // Colors m_vButton->put_BackColor(COLOR_BTNFACE|0x80000000L); m_vButton->put_BackColorStart(RGB(0,255,0)); m_vButton->put_BackColorEnd(RGB(0,0,255)); m_vButton->put_BackColorFocus(COLOR_BTNFACE|0x80000000L); m_vButton->put_BackColorFocusStart(RGB(255,0,0)); m_vButton->put_BackColorFocusEnd(RGB(0,255,0)); m_vButton->put_BackColorHover(COLOR_BTNFACE|0x80000000L); m_vButton->put_BackColorHoverStart(RGB(0,255,255)); m_vButton->put_BackColorHoverEnd(RGB(255,255,0)); m_vButton->put_BackColorPressed(COLOR_BTNFACE|0x80000000L); m_vButton->put_DarkEdgeColor(COLOR_BTNSHADOW|0x80000000L); m_vButton->put_ForeColor(RGB(0,0,0)); m_vButton->put_ForeColorGrayed(RGB(128,128,128)); m_vButton->put_ForeColorDownArrow(RGB(0,255,0)); m_vButton->put_ForeColorPressed(RGB(0,0,0)); m_vButton->put_LightEdgeColor(COLOR_3DHILIGHT|0x80000000L); m_vButton->put_ShadowEdgeColor(COLOR_3DDKSHADOW|0x80000000); m_vButton->put_WhiteEdgeColor(COLOR_3DHIGHLIGHT|0x80000000); 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 CRuntimeDlg::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 CRuntimeDlg::OnQueryDragIcon() { return (HCURSOR) m_hIcon; }