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 using SftBox/OCX for color selection.
The source code is located at C:\Program Files (x86)\Softelvdm\SftBox OCX 5.0\Samples\VB6\Colors\Form1.frm or C:\Program Files\Softelvdm\SftBox OCX 5.0\Samples\VB6\Colors\Form1.frm (on 32-bit Windows versions).
Option Explicit
Private Sub Command1_Click()
Unload Form1
End Sub
Private Function AddColor(Box As SftBox, ByVal Text As String, ByVal color As OLE_COLOR)
Dim OneCell As SftBoxLib50.SftBoxCell
AddColor = Box.Items.Add(Text) ' add a new item
Set OneCell = Box.Cell(AddColor, 0) ' get the first cell
OneCell.Image.Height = 13
If Box Is SftBox2 Then
OneCell.Image.Width = 26
Else
OneCell.Image.Width = 13
End If
OneCell.Image.SetColorSample color, vbBlack ' set the cell's color sample
' We'll save the color value in the cell's Data property so
' we can use the Items.FindCellData method if needed
OneCell.Data = color
End Function
Private Sub AddColors(Box As SftBox)
AddColor Box, "Black", vbBlack
AddColor Box, "Blue", vbBlue
AddColor Box, "Cyan", vbCyan
AddColor Box, "Green", vbGreen
AddColor Box, "Magenta", vbMagenta
AddColor Box, "Red", vbRed
AddColor Box, "White", vbWhite
AddColor Box, "Yellow", vbYellow
AddColor Box, "Scroll bar color", vbScrollBars
AddColor Box, "Desktop color", vbDesktop
AddColor Box, "Color of the title bar for the active window", vbActiveTitleBar
AddColor Box, "Color of the title bar for the inactive window", vbInactiveTitleBar
AddColor Box, "Menu background color", vbMenuBar
AddColor Box, "Window background color", vbWindowBackground
AddColor Box, "Window frame color", vbWindowFrame
AddColor Box, "Color of text on menus", vbMenuText
AddColor Box, "Color of text in windows", vbWindowText
AddColor Box, "Color of text in caption, size box, and scroll arrow", vbTitleBarText
AddColor Box, "Border color of active window", vbActiveBorder
AddColor Box, "Border color of inactive window", vbInactiveBorder
AddColor Box, "Background color of multiple-document interface (MDI) applications", vbApplicationWorkspace
AddColor Box, "Background color of items selected in a control", vbHighlight
AddColor Box, "Text color of items selected in a control", vbHighlightText
AddColor Box, "Color of shading on the face of command buttons", vbButtonFace
AddColor Box, "Color of shading on the edge of command buttons", vbButtonShadow
AddColor Box, "Grayed (disabled) text", vbGrayText
AddColor Box, "Text color on push buttons", vbButtonText
AddColor Box, "Color of text in an inactive caption", vbInactiveCaptionText
AddColor Box, "Highlight color for 3D display elements", vb3DHighlight
AddColor Box, "Darkest shadow color for 3D display elements", vb3DDKShadow
AddColor Box, "Second lightest of the 3D colors after vb3Dhighlight", vb3DLight
AddColor Box, "Color of text face", vb3DFace
AddColor Box, "Color of text shadow", vb3DShadow
AddColor Box, "Color of text in ToolTips", vbInfoText
AddColor Box, "Background color of ToolTips", vbInfoBackground
End Sub
Private Sub Form_Load()
Dim index As Long, column As Integer
With SftBox1.Direct
AddColors SftBox1
' Select "red"
.Items.FindCellData vbRed, 0, -1, 0, index, column
.Items.Selection = index
' make sure we get a horizontal scroll bar
.Items.RecalcHorizontalExtent 0
End With
With SftBox2.Direct
AddColors SftBox2
' Select "red"
.Items.FindCellData vbRed, 0, -1, 0, index, column
.Items.Selection = index
' make sure we get a horizontal scroll bar
.Items.RecalcHorizontalExtent 0
End With
With SftBox3.Direct
AddColors SftBox3
' Select "red"
.Items.FindCellData vbRed, 0, -1, 0, index, column
.Items.Selection = index
' make sure we get a horizontal scroll bar
.Items.RecalcHorizontalExtent 0
End With
End Sub
