vb.net - I can't seem to use GetPixel for Bitmap() Visual Basic -
public class form1 private sub form1_load(sender object, e eventargs) handles mybase.load dim terrain bitmap(500, 500) terrain = new bitmap(500, 500) terrain.getpixel(250, 250) end sub end class
this code , error saying getpixel not member of bitmap()
. i'm not sure i'm doing wrong. please, fault me i'm doing wrong here, i've never coded in vb before.
plesleron
i not sure code pasted if have required.
here example of code need can use bitmap in visual basic.
first need add "imports system.drawing"
here example of code need use bitmap.
imports system imports system.collections.generic imports system.linq imports system.text.regularexpressions imports system.drawing namespace rextester public module program public sub main(args() string) 'your code goes here console.writeline("hello, world!") try ' retrieve image. dim image1 = new bitmap( _ "c:\temp\grapes.jpg", _ true) dim x, y integer ' loop through images pixels reset color. x = 0 image1.width - 1 y = 0 image1.height - 1 dim pixelcolor color = image1.getpixel(x, y) dim newcolor color = _ color.fromargb(pixelcolor.r, 0, 0) image1.setpixel(x, y, newcolor) next next ' set picturebox display image. console.writeline(image1) ' display pixel format in label1. console.writeline("pixel format: " + image1.pixelformat.tostring()) catch ex argumentexception console.writeline("there error." _ & "check path image file.") end try end sub end module end namespace
Comments
Post a Comment