Object Model - Common Properties - BorderColor

Gets or sets a value which defines the color for solid tooltip borders.

[Visual Basic]
Public Property BorderColor As Color
public Color BorderColor {get; set;}

Property Value

Any color provided by the System.Drawing.Color class.




This property defines the color to be used for either solid tooltip borders (Border=Normal) or as background-color for the hatch pattern of tooltips with hatched borders (Border=Hatch).

This property is only significant for tooltip-layouts where the BorderStyle assigned to Border is either Normal or Hatch and BorderWidth is > 0.

If BorderColor is set to Color.Transparent and Border=Normal, the tooltip-border will not become transparent as expected - it will be painted  LightYellow instead, because the Normal-BorderStyle does not support transparent colors.

Transparent borders are supported by the Hatch-BorderStyle instead. If BorderColor is set to Color.Transparent and BorderHatchColor to some color <> Color.Transparent, effects like the following can be created:

Also the inverse (BorderColor <> Color.Transparent and BorderHatchColor = Color.Transparent) is possible:

Note: As stated above, it is not possible to get a transparent border with Border=Normal and BorderColor= Color.Transparent. An invisible border doesn't make much sense anyway, because this combination seems to be optically equivalent to Border=None or BorderWidth=0, but together with BorderWidth>15 an invisible border could be used to increase the distance between the (visible) edges of the tooltip and the pointer. Now, to nevertheless get a fully transparent border, a little workaround is needed. This workaround bases on the fact that the Hatch-BorderStyle does support transparent colors: If we set Border=Hatch, BorderColor=Color.Transparent and BorderHatchColor=Color.Transparent, the tooltip border will become completely invisible.

If specified at the component-level for a tooltip component (i.e. by assigning the value directly to the component), the assigned value will become the default BorderColor for the tooltips of all controls on the same form. This default BorderColor can be overridden for each control through the Override-property provided to all controls on the same form by the tooltip component (see "The Override-Property").

If the override-value for the BorderColor has to be set or changed at runtime for the tooltip of a specific control, code like the following is needed:

Me.MultiLine.GetMultiLineToolTip(Panel1).Override _

.BorderOverride.BorderColor = Color.Red

Example 1

This statements define a default solid green border for all controls on the same form as the tooltip component:

'define a solid green border...

Me.MultiLine.Border = BorderStyle.Normal

Me.MultiLine.BorderWidth = 5  'make the border 5 pixel wide

Me.MultiLine.BorderColor = Color.Green 'assign the desired color

Example 2

This changes the BorderColor for the tooltip of Panel1 to a random color and enforces the overridden border to be painted with a 3 pixel wide, solid color.

Dim R,G,B As Integer

'First, we get random values for the red, green and red

'components of the color to assign.

R = CInt(Int((256) * Rnd()))
G = CInt(Int((256) * Rnd()))
B = CInt(Int((256) * Rnd()))
'Then we create the color with the random RGB-components and assign

'the resulting color as BorderOverride.BorderColor.

Me.MultiLine.GetMultiLineToolTip(Panel1).Override.BorderOverride.BorderColor _

 = Color.FromArgb(R,G,B)

'And to make sure this really applies, we also set

'the other properties correctly to get a solid border....

Me.MultiLine.GetMultiLineToolTip(Panel1).Override.BorderOverride.Border _

 = BorderStyle.Normal

Me.MultiLine.GetMultiLineToolTip(Panel1).Override.BorderOverride _

.BorderWidth = 3