ToolTipsFactory

Object Model - Common Methods and Functions - ScreenColorDepth

This function returns a value indicating the color-depth (bits/pixel) of the screen.

[Visual Basic]
Public Function ScreenColorDepth() As Integer
[C#]
public int ScreenColorDepth();

Parameters

none

Return value

A positive Integer value. 

Description

This function determines the color-depth (bits/pixel) of the screen. Return-values are usually a multiple of 8. Typical return-values for modern systems are 16 bits/pixel (High color) and 32 bits/pixel (True color). 

This function is available because this information might be useful in order to prevent problems with some older graphic adapters and/or graphic drivers. It seems that in some cases older graphic-adapters and/or their corresponding drivers could cause transparency-effects supported by the .NET-framework to not work correctly if the color-depth for the screen is set to True color (32 bits/pixel). In such a (as far as we know, rare) case, tooltip-layouts that make use of transparent colors, might not look as nice as they are supposed to. I.e., the transparent colors would be rendered as either Color.LightYellow or Color.White in this case. (Interestingly, the problem seems not to appear, if the Transparency of the whole tooltip is set to a value > 0.)

Now, if tooltip-layouts with transparent layout-elements are to be used in an application, with the ScreenColorDepth()-function it is possible to find out whether the screen is set to High- or True color and to adjust the concerned tooltip layouts accordingly, in case the screen is set to True color.

As mentioned above, the problem seems to hit only in rare cases. It does not prevent an application to run or somehow adversely affect it's correct operation. In the worst case (depending of the visible parts of the tooltip layout) it could lead to unreadable or ugly looking tooltips. So, if you want your application be bullet-proof at the visual level and you want to make sure that your tooltips look great also on the abovementioned computers, you should address the issue somehow. The ScreenColorDepth()-function helps you in determining whether this is necessary or not.

Example

The following function checks, if the systems color-depth might be a problem and loads an alternative layout (without transparent elements) if necessary:

Private Sub BustTransparencyProblem(ByVal tip As ToolTipsFactorySingleLine)

'determine the bits/pixel....

Dim colorDepth As Integer

colorDepth = Me.ToolTipsFactorySingleLine1.ScreenColorDepth

 

'If we have 32 bits/pixel...

If colorDepth = 32 Then

    '...we better use an alternative layout.

    tip.LoadLayout("CoolButNotTransparent.stt")

End If

End Sub