views:

79

answers:

1

is it possible to choose different colors of different pixels on the background property of a form in vb.net?

i would like to clarify that i do not want to use an image to color the form.

why do i need this? the short answer to that question is: i have a transparent form that will need to detect all the black colors behind it

+1  A: 

You can color individual pixels and perform other drawing on form at runtime using the graphics property of the painteventargs parameter in the paint event of the form. Here's an example that sets the color of a single point (x,y). In your application you might have an array or collection of points, and you might want to use graphics.fillrectangle instead of drawline.

Private Sub form1_Paint(ByVal sender As Object, ByVal e As PaintEventArgs) Handles Me.Paint
e.Graphics.DrawLine(Pens.Aquamarine, x, y, x, y)
end sub

xpda