screen color picker cq. selector (1 Viewer)

noorman56

New member
Local time
Today, 19:55
Joined
Nov 20, 2021
Messages
3
I want to make an colorpicker in msacces. So i can pick on the desktop screen any color i want.
like the program jcpicker.
This is what working in VB net:
Dim bmp As New Drawing.Bitmap(1, 1)
Dim gfx As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(bmp)
gfx.CopyFromScreen(New Drawing.Point(MousePosition.X, MousePosition.Y), New Drawing.Point(0, 0), bmp.Size)
Dim pixel As Drawing.Color = bmp.GetPixel(0, 0)
Cpanel.BackColor = pixel
RedTextBox.Text = pixel.R
GreenTextBox.Text = pixel.G
BlueTextBox.Text = pixel.B

But how can i do this in VBA in msacces??
 

theDBguy

I’m here to help
Staff member
Local time
Today, 10:55
Joined
Oct 29, 2018
Messages
21,551
Have you tried this one?

 

isladogs

MVP / VIP
Local time
Today, 18:55
Joined
Jan 14, 2017
Messages
18,258
Or this very similar application which uses some of the same code
 
Last edited:

Pat Hartman

Super Moderator
Staff member
Local time
Today, 13:55
Joined
Feb 19, 2002
Messages
43,501
Is the color picker for your design use or for you to expose to the user? I would be leery of anything that doesn't use themes. Themes are still clunky but they are better than manually choosing colors for objects.
 

noorman56

New member
Local time
Today, 19:55
Joined
Nov 20, 2021
Messages
3
Is the color picker for your design use or for you to expose to the user? I would be leery of anything that doesn't use themes. Themes are still clunky but they are better than manually choosing colors for objects.
for me is it important to choose the colors manually of an object. and save the hexcode of the color in the database with project name and name client. So I can see later wich colors is used for various clients and associated projects. And themes are not an issue at all for this project.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 13:55
Joined
Feb 19, 2002
Messages
43,501
Just sayin' I've stopped making manual color choices. They are way too time consuming to change if you end up needing to.
 
Last edited:

Nixversteher

New member
Local time
Today, 10:55
Joined
Feb 25, 2018
Messages
16
I believe that this is already possible. In the simplest case a form timer that reads the pixel under the mouse. Attached is a simple example, based on your sample code above.
 

Attachments

  • Color_Mouse.accdb
    512 KB · Views: 94

sonic8

AWF VIP
Local time
Today, 19:55
Joined
Oct 27, 2015
Messages
999
Attached is a simple example, based on your sample code above.
Congratulations @Nixversteher, well done! It looks like you were the only respondent, who actually read and understood the question.
I don't like the use of the timer in the example, however I can't think of any alternative that could be implemented with reasonable effort.
 

Users who are viewing this thread

Top Bottom