Full width home advertisement

Post Page Advertisement [Top]

In VB6, PictureBox Control have two methods namely PSet, and point which sets the color of given pixel position or retrieve the color for same.

But in VB.Net, PictureBox Control doesn't have these two methods. But there is an alternative and best way.

Here, we create an image of 100 x 100 pixels in which we set the pixels.

Dim bmp As New Bitmap(100, 100)

        For X = 0 To bmp.Width - 1

            For Y = 0 To bmp.Height - 1
                bmp.SetPixel(X, Y,Color.Black)
            Next Y
        Next X

        PictureBox1.Image = bmp

To get an pixel use:

Dim col As Color, R As Integer, G As Integer, B As Integer
col = bmp.GetPixel(X,Y)
R = col.R
G = col.G
B = col.B

No comments:

Post a Comment

Bottom Ad [Post Page]

| Designed by Colorlib