image's read pixel with VB6
-
Hi, Now I read images properties with "type declaration". But I don't still image's read pixels. How I read image's line? (10W, 50H) 1,2,3,4,5,6,7,8,9,10W, 1st H 1,2,3,4,5,6,7,8,9,10W, 2st H 1,2,3,4,5,6,7,8,9,10W, 3st H ... 1,2,3,4,5,6,7,8,9,10W, 50th H http://www.2ncielbilgisayar.com
-
Hi, Now I read images properties with "type declaration". But I don't still image's read pixels. How I read image's line? (10W, 50H) 1,2,3,4,5,6,7,8,9,10W, 1st H 1,2,3,4,5,6,7,8,9,10W, 2st H 1,2,3,4,5,6,7,8,9,10W, 3st H ... 1,2,3,4,5,6,7,8,9,10W, 50th H http://www.2ncielbilgisayar.com
HI, I can't fully understand your question but if your trying to read the image pixel in VB then here's an alternative. 1. Put a PictureBox in your form. 2. Load your desired image by setting its Picture property. 3. Then use this code dim x as long dim y as long dim rgbColor as long For y = 0 To picBox.ScaleHeight - 1 For x = 0 To picBox.ScaleWidth - 1 rgbColor = GetPixel(picBox.hDC, x, y) Next x Next y
-
HI, I can't fully understand your question but if your trying to read the image pixel in VB then here's an alternative. 1. Put a PictureBox in your form. 2. Load your desired image by setting its Picture property. 3. Then use this code dim x as long dim y as long dim rgbColor as long For y = 0 To picBox.ScaleHeight - 1 For x = 0 To picBox.ScaleWidth - 1 rgbColor = GetPixel(picBox.hDC, x, y) Next x Next y
You understood me. Thank you. rgbColor = GetPixel(picBox.hDC, x, y) I saw a few .hDC in example codes. And you wrote .hDC in your code. what does .hDC? Has vb6 got GetPixel command? http://www.2ncielbilgisayar.com
-
You understood me. Thank you. rgbColor = GetPixel(picBox.hDC, x, y) I saw a few .hDC in example codes. And you wrote .hDC in your code. what does .hDC? Has vb6 got GetPixel command? http://www.2ncielbilgisayar.com
GetPixel is an API. You can declare this at the top of your code Private Declare Function GetPixel Lib "gdi32" _ (ByVal hDC As Long, _ ByVal x As Long, _ ByVal y As Long) As Long hDC is a device context handle, needed when working a display or printer. This can be compared to HWND when your are working with window object, one use of HDC on the other hand is for drawing.