PRB: Value of the Point Function Does Not Match Set Color (190180)
The information in this article applies to:
- Microsoft Visual Basic Learning Edition for Windows 5.0
- Microsoft Visual Basic Learning Edition for Windows 6.0
- Microsoft Visual Basic Professional Edition for Windows 5.0
- Microsoft Visual Basic Professional Edition for Windows 6.0
- Microsoft Visual Basic Enterprise Edition for Windows 5.0
- Microsoft Visual Basic Enterprise Edition for Windows 6.0
- Microsoft Visual Basic Standard Edition, 32-bit, for Windows 4.0
- Microsoft Visual Basic Professional Edition, 16-bit, for Windows 4.0
- Microsoft Visual Basic Professional Edition, 32-bit, for Windows 4.0
- Microsoft Visual Basic Enterprise Edition, 16-bit, for Windows 4.0
- Microsoft Visual Basic Enterprise Edition, 32-bit, for Windows 4.0
This article was previously published under Q190180 SYMPTOMS
When using the Visual Basic Point function to determine the color of the
specified point, the RGB color value returned does not always match the
region's color as set by the developer at design-time. Consequently, direct
comparisons between a given point's color and a color property setting
should be avoided because the values may not always agree.
CAUSE
This problem is typically the result of one of the following situations:
- The developer has set the color value for a property to a system color
(such as., &H80000001) instead of a valid RGB color value. The Point
method will always return an RGB value.
- The color value has been set to a color that is not within the range of
valid colors for the video hardware (or display settings) on an end
user's system. Such colors are typically translated to the nearest
matching color based on the available system palette. This means that
you can never guarantee that the Point function will exactly match the
developer's chosen design-time color value.
RESOLUTION
The only way to guarantee that a value returned from the Point function is
the color setting chosen by the developer is to set a variable at run-time
to a known point that contains the correct color, and use this value during
comparisons. For example, if you know that coordinate 100,100 always
contains the FillColor then you can set a variable to Point(100,100), and
then use this variable when comparing a given point's color to the
FillColor, as follows:
ActualFillColor = Point(100, 100)
If ActualFillColor = Point(x, y) Then
' Do some code ...
End If
STATUS
This behavior is by design.
Modification Type: | Minor | Last Reviewed: | 7/14/2004 |
---|
Keywords: | kbprb KB190180 |
---|
|