Skip to content

Properties, Events, Methods

Carlos Alloatti edited this page May 30, 2017 · 3 revisions

DropDownClick (Event)

Fired when the user clicks the right part of a splitbutton control

Remarks:

Usually the code in this event should display a dropdown menu. The dropdown menu generation code is not implemented yet, I use a separate class for generic context menus for this, that I will integrate some day into this classes.


Picture (Property)

Specifies the picture displayed in the control. There is no need to specify additional pictures, the downpicture and disabled pictured are automatically created from this picture. Actually, three aditional pictures are created, one each for HOT, PRESSED and DISABLED states. The HOT state picture is slightly brighter, the PRESSED picture is a bit darker, and the disabled picture uses the same color matrix used by the Net Framework to create disabled pictures.

The picture specified can be any format or size, the class converts, resizes, and applies transparency as needed.

Pictures do not have to be of a certain size to be used as a control picture. The control can automagically adjust the picture size. The picture file format can be any type supported by GDI+ : BMP, GIF, JPEG, PNG, TIFF, Exif, WMF, and EMF.

For formats that do not have transparency, like bmp, the control assumes the color of the top left pixel of the image should be made transparent.


PicturePosition (Property)

All values 0 to 14 are supported.


PictureVal (Property)

Value Type: String

Default Value: NONE

R/W: Read/Write.

Like the PictureVal property of image controls


ToolTipText (Property)

The control implements native API tooltips, so they will display with the look determined by the operating system version.


tbAlign (Property)

Value Type: Numeric.

Default Value: 1

R/W: Read/Write.

Specifies the alignment of the control relative to the parent control or form. Possible values are:

0 = No alignment

1 = Left aligned

2 = Right aligned

Remarks:

When tbAlign is 0, the control is not moved in the INIT event of the form.

When tbAlign is 1, the control is aligned to the left side of the form in the INIT event of the form. The leftmost control will have a margin from the left form border equal to the value of the tbMarginH property. The spacing between controls is determined by the value of the tbMargin property.

When tbAlign is 2, the control is aligned to the right side of the form in the INIT event of the form. The rightmost control will have a margin from the right form border equal to the value of the tbMarginH property. The spacing between controls is determined by the value of the tbMargin property.

When tbAlign is either 1 or 2, the controls are also aligned to the top/bottom of the form, with a margin from the form top/bottom border equal to the value of the tbMarginV property, but only if they are near the form top/bottom border by a value equal or less than tbMarginV.

How it works:

During the control INIT, a BINDEVENT to the form INIT is established, to the control _ARRANGECONTROLS method. This method searches the form for controls with the same TOP value, with the same tbAlign value, and determines if the control is the leftmost/rightmost control of the group. If the control is the leftmost/rightmost control, it moves itself to the left/right border of the form, and then moves each control of the group in sequence, taking into account each individual control width and tbMargin.


tbAutoColor (Property)

Value Type: Logical.

Default Value: .T.

R/W: Read/Write.

Specifies if the control changes its color to match the color of the parent BACKGROUND.

Remarks:

The image png that determines the control style may have some general color hue that has to be changed to match the background of the control. For some styles, this is not desired. Some styles have transparent or semitransparent pixels that should be applied as is, without changing its colors.

The class uses the value of the top left pixel of the style png to determine if the color should really be changed when tbAutoColor is TRUE. if this pixel is black with a 100% transparency, the colors are not changed.

How it works:

The colors of the style png are changed using GDIPLUS by aplying a color matrix transformation to the bitmap.


tbAutoFontName (Property)

Value Type: Logical.

Default Value: .T.

R/W: Read/Write.

Specifies if the control uses the default font name of the system for the control caption, or the font specified in the FontName property.

Remarks:

Different versions of Windows use different fonts for the user interface, for example Windows 7 uses SEGOE UI 9pt, Windows XP uses TAHOMA 8pt. When this property is TRUE, the default system font is used, instead of the font specified in the property FontName.

How it works:

When set to TRUE, a call to SystemParametersInfo is used to obtain a NONCLIENTMETRICS structure that includes an lfMessageFont LOGFONT structure of the font used in message boxes. This structure is used to create the font used in the control.

When set to FALSE, a LOGFONT structure is created with the values of the control Font related properties.


tbAutoFontSize (Property)

Value Type: Logical.

Default Value: .T.

R/W: Read/Write.

Specifies if the control uses the default font size of the system for the control caption, or the font size specified en the FontSize property.

Remarks:

This property is only used when tbAutoFontName is TRUE. If tbAutoFontName is FALSE, then this property has no effect.

Different versions of Windows use different fonts for the user interface, for example Windows 7 uses SEGOE UI 9pt , Windows XP uses TAHOMA 8pt. When this property is TRUE, the default system font size is used, instead of the font size specified in the property FontSize.

How it works:

When tbAutoFontName is TRUE and this property is FALSE, a call to SystemParametersInfo is used to obtain a NONCLIENTMETRICS structure that includes a lfMessageFont LOGFONT structure of the font used in message boxes. The value of lfHeight in the structure is updated with the value of the FontSize property and then this structure is used to create the font used in the control.

This property was implemented because I prefer to use the system default fonts, but with an 8 pt size instead of the 9pt default value of Windows 7.


tbAutoWidth (Property)

Value Type: Logical.

Default Value: .T.

R/W: Read/Write.

Specifies if the control width is adjusted in relation to the width of the caption property.

Remarks:

This property only has effect when the control is instantiated, subsequent changes of the caption text have no effect in the control width.

Clone this wiki locally