VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Color RGB from a Long Using Point method

by Brandon Brownlee (1 Submission)
Category: Math/Dates
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Date Added: Wed 3rd February 2021
Rating: (39 Votes)

After using the POINT method the computer returns a long value like 16711680 but with this function it will return the color in the RGB(R,G,B)
format.

Assumes
Start a new project and make any picture you have the background for your form. Then start it and move the mouse on the form and look at the caption of the form.
Code Returns
Returns Rgb(R,G,B) format from a Long Value

Rate Color RGB from a Long Using Point method

Public Blue As Double
Public Green As Double
Public Red As Double
Public BlueS As Double
Public GreenS As Double
Public RGBs As String
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, _
Y As Single)
Call ConvertRGB(Form1.Point(X, Y))
Form1.Caption = RGBs
End Sub
Public Function ConvertRGB(P)
  Blue = Fix((P / 256) / 256)
  BlueS = (Blue * 256) * 256
  Green = Fix((P - BlueS) / 256)
  GreenS = Green * 256
  Red = Fix(P - BlueS - GreenS)
  RGBs = "RGB(" & Red & ", " & Green & ", " & Blue & ")"
End Function

Download this snippet    Add to My Saved Code

Color RGB from a Long Using Point method Comments

No comments have been posted about Color RGB from a Long Using Point method. Why not be the first to post a comment about Color RGB from a Long Using Point method.

Post your comment

Subject:
Message:
0/1000 characters