contents   index   previous   next



AddControl Method

 

Adds a control to the collection of controls that will be enhanced by UIToolX.

 

Syntax

 

UIToolX1.AddControl (fwControl As Object,_

       fwBorderStyle As e_BorderStyle, _

       fwMouseOver As Boolean, _

       [fwMargin As Integer = -1], _

       [fwCustomBorder As Boolean = False], _

       [fwBorderColor As OLE_COLOR = -1], _

       [fwBackColor As OLE_COLOR = -1], _

       [fwForeColor As OLE_COLOR = -1], _

 [fwPaintStyle As e_PaintStyle = -1])

 

 

Example

 

UIToolX1.AddControl Text1, fwNone, fwFlat, True, 4, vbGreen, vbYellow, vbRed

 

 

 

This method adds will add the control into the collection of controls that is enhanced by UIToolX.

 

In the example above, Text1 will have no border, respond to MouseOver and have four (4) pixel wide right and left margins. It will also have a very ugly color scheme.

 

 

 

Usage Notes

 

Use this method if you would like to change the appearance of selected controls. Since most controls will have the same style, in most cases you would use AutoAdd and then use AddControl to adjust a small number of controls. You could also loop through the controls collection and use AddControl.

 

If you are going to use AddControl, we recommend using a wrapper function to make future changes easier. You could also use the wrapper function to allow you to easily pick the color scheme at runtime. For example:

 

Public Sub UIWrapper(UI As UIToolX, ctl As Control, ColorScheme As Integer)

    Select Case ColorScheme

        Case 1  ' Money

            UI.AddControl ctl, fwNoBorder, True, 4, True, &H6F7D7D, &HDEE7EF, &H6F7D7D

        Case 2  ' XP

            UI.AddControl ctl, fwNoBorder, True, 4, True, &HAE9679, , &HAE9679

        Case 3  ' CoolGrey

            UI.AddControl ctl, fwThinBorder, True, 4, True, &HAE9679, &HEEEEEE, &H666666

        Case 4  ' Third party combo

            UI.AddControl ctl, fwNoBorder, True, 4, True, &HAE9679, &HEEEEEE, &H666666, fwComboBox

        Case Else

            UI.AddControl ctl, fwNoBorder, True, 4, True, &HC7856D, &H8000000F, &H666666

    End Select

End Sub

 

 

Of course, you would probably want to also read the colors from the Registry or a file.

 

 

 

In addition, keep in mind that if you do not specify a color that the appropriate global UI_*Color will be used. This also requires that UI_BorderColorEnble = True. So if you look at Case 2 in the example above.

 

 

 

The last parameter, fwPaintStyle, is used to specify how UIToolX will paint the control passed in fwControl. Use this parameter when you are passing controls that are not intrinsic controls. For example, a third party DB ComboBox would use the fwComboBox enum for fwPaintStyle. UIToolX will the use its combobox template to enhance this third party control. Unexpected results may occur if the third party vendor uses controls that differ much from the standard operating system controls.