Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
Just a few simple color functions. Probably everyo...
Author:
Shadows
Submitted:
6/10/2002
Version:
VB6
Compatibility:
VB6
Category:
Graphics
Views:
8223
Just a few simple color functions. Probably everyone but newbies already know these. Put this in a public module. #1: Inverts Colors #2: Switches color values
Declarations:
'none
Code:
Enum Switches swRed = 1 swGreen = 2 swBlue = 3 End Enum Function InvertColor(color as long) as long dim r1 as byte, g1 as byte, b1 as byte dim r2 as byte, g2 as byte, b2 as byte 'color buffers r1 = color mod &H100 g1 = (color \ &H100) mod &H100 b1 = ((color \ &H100) \ &H100) mod &H100 r2 = (r1 + 255) mod 255 g2 = (g1 + 255) mod 255 b2 = (b1 + 255) mod 255 InvertColor = RGB(r2, g2, b2) end function 'inverts color Function SwitchRGB(makeRed as Switches, makeGreen as Switches, makeBlue as Switches) as long Dim Colors(2) as long Colors(0) = color mod &H100 Colors(1) = (color \ &H100) mod &H100 Colors(2) = ((color \ &H100) \ &H100) mod &H100 SwitchRGB=RGB(Colors(makeRed-1), Colors(makeGreen-1) ,Colors(makeBlue-1)) end function 'takes some getting used to, but fun
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement