How can I get the color of an arcshape

have a number of arcshapes with different colors, each representing products. I want to query the shape color to determine the product. Can this be done?

I assume you want to click on the arcshape in a canvas and determine the color. This code in the MouseDown event should do it.

Dim c As Color 
Dim p As New Picture(Me.Width, Me.Height)
Me.DrawInto(p.Graphics, 0, 0)

Dim surf As RGBSurface = p.RGBSurface
c = surf.Pixel(x, y)

Once you have the color, the rest is up to you.

Bear in mind that even if you set an arcshape to “this color”,
what you get back from that surf.pixel() call may not be the color you expect, due to color profiles.

…and since it is you who set the color value to the arc shape, set a property and attribute it that color to it.


I did not set initial colors - inherited code. Thanks for responding

Thanks for the reminder