Link to home
Start Free TrialLog in
Avatar of hess
hess

asked on

Pixel Color and MDI workspace color

How can I get the color of the bottom most right most pixel of an mdi forms picture (i.e. MDIform1.picture) and set the back ground property of the mdi form to that color.

I don't want to use any extra picture box controls if i dont have to.
Avatar of fbtcell
fbtcell

May be you can try GetPixel API function to have the color of the pixel :
color = GetPixel(MDIform1.picture.hdc, x, y)
where x and y stand for the right (and top or left) most coordinates.

And then set the back ground property of the mdi form :
MDIform1.BackColor = color

fbtCell - one problem with that answer : there is no hdc property of an MDI form's picture.
I tried on an MDI form.
Make sure that MDIform1.HasDC = True and then call :
color = GetPixel(MDIform1.hDC, x, y)

(i just belived that MDIform1.picture was a PictureBox, and PictureBox used to have one hdc).
ASKER CERTIFIED SOLUTION
Avatar of Erick37
Erick37
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of hess

ASKER

Sorry, Eric37 Has the answer i'm looking for.
Avatar of hess

ASKER

This was great and did exactly what i needed