RGB Function - VB & VBA In A Nutshell: The Language [Book]
Có thể bạn quan tâm
Get full access to VB & VBA in a Nutshell: The Language and 60K+ other titles, with a free 10-day trial of O'Reilly.
There are also live events, courses curated by job role, and more.
Start your free trialRGB Function |
Named Arguments
Yes
Syntax
RGB(red, green, blue)red
Use: Required
Data Type: Variant (Integer)
A number between 0 and 255, inclusive.
green
Use: Required
Data Type: Variant (Integer)
A number between 0 and 255, inclusive.
blue
Use: Required
Data type: Variant (Integer)
A number between 0 and 255, inclusive.
Return Value
A long integer representing the RGB color value.
Description
Returns a system color code that can be assigned to object color properties.
Rules at a Glance
The RGB color value represents the relative intensity of the red, green, and blue components of a pixel that produces a specific color on the display.
The RGB function assumes any argument greater than 255 is 255.
The following table demonstrates how the individual color values combine to create certain colors:
Color Red Green Blue Black 0 0 0 Blue 0 0 255 Green 0 255 0 Red 255 0 0 White 255 255 255
Programming Tips and Gotchas
The RGB value is derived with the following formula:
RGB = red + (green * 256) + (blue * 65536)In other words, the individual color components are stored in the opposite order one would expect. VB stores the red color component in the low-order byte of the long integer's low-order word, the green color in the high-order byte of the low-order word, and the blue color in the low-order byte of the high-order word.
Visual Basic now contains a wide range of intrinsic color constants that can assign color values directly to color properties of objects.
See Also
QBColor Function ...Get VB & VBA in a Nutshell: The Language now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.
Start your free trialDon’t leave empty-handed
Get Mark Richards’s Software Architecture Patterns ebook to better understand how to design components—and how they should interact.
It’s yours, free.
Get it now CloseCheck it out now on O’Reilly
Dive in for free with a 10-day trial of the O’Reilly learning platform—then explore all the other resources our members count on to build skills and solve problems every day.
Start your free trial Become a member now CloseTừ khóa » Visual Basic Colors
-
Settings
-
RGB Function (Visual Basic For Applications) - Microsoft Docs
-
RGB Colours - Excel At Finance
-
Excel VBA: ColorIndex Codes List & RGB Colors
-
Colors : Visual Basic - BrainBell
-
Excel VBA Color Code List - ColorIndex, RGB Color, VB Color
-
VB Colors Name List | MrExcel Message Board
-
Using The RGB Function - Event Procedures - Visual Basic Planet
-
Microsoft Visual Basic - Color Changer - FunctionX
-
VB.Net - ColorDialog Control - Tutorialspoint
-
VB.NET Color Names
-
[PDF] Everything You Wanted To Know About Visual Basic 6 Colors
-
Using Different Colors In Visual Basic - VB.Net Tutorial