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
Adding SftMask/OCX To The Toolbox
Adding SftMask/OCX To A Project
Adding The SftHelperComponent To A Project
Preparing a Project
Special Considerations
- Indexed Properties
- Picture Properties
- Font Properties
- Color Properties
Object vs. Interface
The controls are automatically added to the Visual Studio Toolbox in the toolbox group "Softel vdm, Inc.", except for Visual Studio .NET 2002 and some Visual Studio Express Editions. For these, the controls have to be added "manually" using the simple procedure outlined in "Adding Controls To The Visual Studio Toolbox".
If you are using Visual Studio .NET 2002 or any of the Visual Studio Express Editions, please take a moment to add the controls using the simple procedure outlined in "Adding Controls To The Visual Studio Toolbox" before continuing.
The SftMask/OCX control can be added to a form, by locating the control in the toolbox group "Softel vdm, Inc.". It can be added to a form by clicking on the SftMask/OCX button of the toolbox, then clicking on the form or by dragging the SftMask/OCX button of the toolbox to the form.
In order to be able to use .NET images, color and font properties, a small helper component must be added to each project that uses SftMask/OCX. This helper component assists in to converting OLE types to .NET types.
The SftHelperComponent control can be added to a form, by locating the control in the toolbox group "Softel vdm, Inc.". It can be added to a form by clicking on the SftHelperComponent button of the toolbox, then clicking on the form or by dragging the SftHelperComponent button of the toolbox to the form.
The component will not appear on the form, but will instead be shown as a component used by the form.
Add the following Imports and using statements to your project source file(s). This simplifies name resolution, makes most enumerated constants available and provides access to the OLECvt class.
VB
Imports AxSftMaskLib70 Imports SftMaskLib70 Imports Softelvdm.OLEConvert
C#
using SftMaskLib70; using AxSftMaskLib70; using Softelvdm.OLEConvert;
All required steps have now been completed to use SftMask/OCX.
For a complete example, add the following sample code to initialize the control:
VB
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load AxSftMask1.Mask = "$D $T" AxSftMask1.EditStyle = SftMaskEditStyleConstants.editSftMaskCalendarDropDown AxSftMask1.Contents.DateTime = #12/31/2014 9:00:00 AM# AxSftMask1.TabAdvance = True AxSftMask1.AutoAdvance = True End Sub
C#
private void Form1_Load(object sender, System.EventArgs e) {{ axSftMask1.Mask = "$D $T" axSftMask1.EditStyle = SftMaskEditStyleConstants.editSftMaskCalendarDropDown; System.DateTime dateTime = new System.DateTime(2014, 12, 31, 9, 0, 0, 0); axSftMask1.Contents.DateTime = dateTime; axSftMask1.TabAdvance = true; axSftMask1.AutoAdvance = true; }}
In this example, the control is initialized at run-time using code. Of course it is also possible (and much easier) to set up all properties using the property pages. You can access the property pages by right-clicking on the control and select the Properties... entry of the popup menu.
You can run the sample application and it displays an edit control allowing entry of a date and time value with a popup calendar.
This sample displays an edit control for numeric input with popup calculator:
VB
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load AxSftMask1.Mask = "!1$C,8.2!!" AxSftMask1.Alignment = SftMaskAlignConstants.alignSftMaskRight AxSftMask1.Contents.Value(1) = 88.12 End Sub
C#
private void Form1_Load(object sender, System.EventArgs e) {{ axSftMask1.Mask = "!1$C,8.2!!" axSftMask1.Alignment = SftMaskAlignConstants.alignSftMaskRight; axSftMask1.Contents.set_Value(1, 88.12); }}
After adding the control to the form, right click on the control and select the Properties... entry of the popup menu. This displays the Property Dialog for the control.
Please note that you can right-click on a property. This displays a popup menu which can be used to access help information for the property or Property Dialog. Or double-click on the description of a property to access its help information.
This control has many properties and methods which you can use. This is a very simple example and doesn't even begin to exploit the capabilities of this control. Please take a moment to familiarize yourself with the objects offered by the SftMask/OCX control. Each object represents a specific area of the control and can be fully customized. Also make sure to run the demo which is included with this product and take a look at the included samples.
When adding SftMask/OCX to a project, Visual Studio .NET generates a class wrapper to fully support an ActiveX control such as SftMask/OCX. Unfortunately, this class wrapper is slightly incomplete and generates initially unexpected function names for certain properties. However, these issues are easily resolved.
Indexed properties (i.e., properties which require additional parameters, such as an index) are converted into method calls with a get_ and set_ prefix.
For example, the Contents.Value property, which requires a subscript (or index), is used as follows:
object val = axSftMask1.Contents.get_Value(1);
All other properties with additional parameters use a get_ and set_ prefix.
The Syntax portion of each method, property and event shows the full syntax, including any prefix (such as get_ and set_, etc.).
While some graphics properties are generated to use an Image type, many properties and methods do not. These use the OLE picture type stdole.IPictureDisp instead, which cannot directly be used with an Image type. The Syntax portion of each method, property and event shows the full syntax and required picture type (Image or stdole.IPictureDisp).
The Image type can easily be converted into a stdole.IPictureDisp type using the provided class OLECvt. This class is added to each project using Softelvdm.OLEConvert (see Preparing a Project above).
VB
Public Shared Function ToIPictureDisp(ByVal i As Image) As stdole.IPictureDisp Public Shared Function ToImage(ByVal pic As stdole.IPictureDisp) As Image
C#
public static stdole.IPictureDisp ToIPictureDisp(Image i); public static Image ToImage(stdole.IPictureDisp pic);
ToIPictureDisp returns a stdole.IPictureDisp pointer given an Image object.
If you are using the same image many times, make sure to convert it once only and use the saved stdole.IPictureDisp. Converting the same image many times will create multiple OLE Picture objects, which can deplete virtual storage and available systems resources.
The Syntax section of picture properties typically shows Get, Put and PutRef forms. If both Put and PutRef are available, PutRef is the preferred form as it conserves resources and assigns a picture object reference to the control. Put causes the control to completely copy the picture object.
While some font properties are generated to use a Font type, many properties and methods do not. These use the OLE font type stdole.IFontDisp instead, which cannot directly be used with a Font type. The Syntax portion of each method, property and event shows the full syntax and required font type (Font or stdole.IFontDisp).
The Font type can easily be converted into a stdole.IFontDisp type using the provided class OLECvt. This class is added to each project using Softelvdm.OLEConvert (see Preparing a Project above).
VB
Public Shared Function ToIFontDisp(ByVal f As Font) As stdole.IFontDisp
C#
public static stdole.IFontDisp ToIFontDisp(Font f);
ToIFontDisp returns an stdole.IFontDisp pointer given a Font object.
If you are using the same font many times, make sure to convert it once only and use the saved stdole.IFontDisp. Converting the same font many times will create multiple OLE Font objects, which can deplete virtual storage and available systems resources.
The Syntax section of font properties typically shows Get, Put and PutRef forms. If both Put and PutRef are available, PutRef is the preferred form as it conserves resources and assigns a font object reference to the control. Any change to the font object is reflected in the control also. Put on the other hand causes the control to completely copy the font object.
Color properties without parameters of the SftMask object use the .NET Color structure, but all other properties and objects (such as SftMaskCalculator, etc.) use the native type UInt32 (uint). Converting a .NET Color structure color to a UInt32 (OLE color value) and vice versa is easily accomplished using the provided class OLECvt. This class is added to each project using Softelvdm.OLEConvert (see Preparing a Project above).
VB
Public Shared Function ToOleColor(ByVal clr As System.Drawing.Color) As UInt32 Public Shared Function ToColor(ByVal clr As UInt32) As System.Drawing.Color
C#
public static uint ToOleColor(System.Drawing.Color clr); public static System.Drawing.Color ToColor(uint clr);
The valid range for a color value is 0 to 16,777,215 (&HFFFFFF). The high order byte of a number in this range equals 0; the lower 3 bytes, from least to most significant byte, determine the amount of red, green, and blue, respectively. The red, green, and blue components are each represented by a number between 0 and 255 (&HFF). If the high byte is not 0, the system colors as defined in Control Panel's settings are used. The Windows API GetSysColor defines all valid constants. Please see your development environment's documentation for applicable color constants.
The Syntax portion of each method and property shows whether a Color structure or an OLE color value is used.
Color Structure - VB
AxSftMask1.BackColor = SystemColors.Highlight AxSftMask1.BackColor = Color.Red AxSftMask1.BackColor = OLECvt.ToColor(&HFF) ' red Dim c As Color c = AxSftMask1.BackColor
Color Structure - C#
AxSftMask1.BackColor = SystemColors.Highlight; AxSftMask1.BackColor = Color.Red; AxSftMask1.BackColor = OLECvt.ToColor(0x00000ff); // red
Color c = AxSftMask1.BackColor;
OLE Color Value - VB
AxSftMask1.Calculator.BackColor = OLECvt.ToOleColor(SystemColors.Highlight) AxSftMask1.Calculator.BackColor = OLECvt.ToOleColor(Color.Red) AxSftMask1.Calculator.BackColor = &HFF ' red Dim c As Color c = OLECvt.ToColor(AxSftMask1.Calculator.BackColor))
OLE Color Value - C#
AxSftMask1.Calculator.BackColor = OLECvt.ToOleColor(SystemColors.Highlight); AxSftMask1.Calculator.BackColor = OLECvt.ToOleColor(Color.Red); AxSftMask1.Calculator.BackColor = 0x00000ff; // red
Color c = OLECvt.ToColor(AxSftMask1.Calculator.BackColor);
The main control is represented by an object of the SftMask class, but can also be represented by its ISftMask interface. The ISftMask interface can be retrieved using the Direct property.
Certain methods and properties have different names and return types, based on how they are accessed. While (for example) an object based on the SftMask class is mostly equivalent to the ISftMask interface exposed by the control, .NET can introduce minor differences. Such differences are shown in the Syntax section of the affected methods and properties. All other classes are identical to their interfaces and no distinction is made.
The Syntax portion shows both forms, the class member and the interface method (the interface method is always marked with a Note indicator). If both forms are identical, only one entry is shown.
Some properties (particularly font and picture properties) may require different types. For example, the Font property accepts a System.Drawing.Font when accessed through a SftMask class object, but uses a stdole.IFontDisp interface pointer when accessed directly though the ISftMask interface pointer. stdole.IFontDisp can be provided using the OLECvt class.
Some properties or methods use different names, depending on how they are accessed. For example, the Refresh method is named CtlRefresh when accessed through a SftMask class object. When accessed directly though the ISftMask interface pointer it is named Refresh.
Other classes, such as SftMaskCaption and SftMaskAutoComplete, make no distinction between the class and interface. The classes SftMaskCaption and SftMaskAutoComplete are equivalent to their respective interfaces ISftMaskCaption and ISftMaskAutoComplete.