"djharrison" <da************@netscape.net> wrote in message
news:75**************************@posting.google.c om...
I am attempting to develop an application that will color the pixels
in a PictureBox based on the x and y coordinates for individual pixels
in an array. I would like to load the values into the array from a
database. Does this sound feasible? I'm new to CDI+ programming. I
thougnt he SetPixel method would work best but i'm not sure how to
proceed. Can I grab the values right from the database into the
PictureBox?
The best way to do that would be to load the values from the database
into a new Bitmap object, then assign that Bitmap to the PictureBox's Image
property:
Dim bmp As Bitmap = New Bitmap(100, 100)
For x As Integer = 0 to xxx
For y As Integer = 0 to yyy
Dim currentColor As Color
currentColor = GetColorFromDatabase(x, y)
bmp.SetPixel(x, y, currentColor)
Next y
Next x
PictureBox1.Image = bmp
But really, why not just store the bitmap files themselves in the
database (or even just as files)? That would greatly speed things up, not
to mention saving tons of space in the database and drastically simplifying
queries.
Jeremy