Working With Pictures

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Does anyone have any good examples of code for this type of situation?

I have a data table that stores information about individuals. I also have
the need to store a picture of the individual for display and ID badge
printing.

#1, I found it discouraging that the Picture Box control did not support
Drag And Drop. Any thoghts here?

#2, How do you store a picture to a SQL table?

Thanks in advance.
 
Hello
#1, I found it discouraging that the Picture Box control did not support
Drag And Drop. Any thoghts here?
Its been a while since i have used the picture box control. Are you sure this is correct?
Picturebox inherits from control and so it would have available drag drop members associated with
it.
#2, How do you store a picture to a SQL table?
You basically just split your image into a byte array and store that in the db.

Heres and example:

http://www.dotnet247.com/247referen...harpcorner.com/Code/2002/Feb/FlashCardsMG.asp
 
EdB,

For the drag and drop see the samples on MSDN.

Here beneath my complete sample for everything with a Blob about reading and
writing to a Dataset (and with that to an SQL server) avoiding in my idea
some extra processing that is in the samples on MSDN.

http://groups.google.com/groups?selm=#[email protected]

I would use instead of complete images thumbnails for your problem, maybe
you can see the sample snippet bellow as an extention form the code in the
message above,

\\\
Dim arrImage() As Byte = DirectCast(rdr.Item("Photo"), Byte())
Dim ms1 As New System.IO.MemoryStream(arrImage)
Dim origimage As System.drawing.Image =
System.Drawing.Image.FromStream(ms1)
Dim PThumbnail As System.drawing.Image
PThumbnail = origimage.GetThumbnailImage(100, 100, Nothing, New IntPtr)
ms2 As New System.IO.MemoryStream
PThumbnail.Save(ms2, Imaging.ImageFormat.Bmp)
arrImage = ms2.GetBuffer
///

I hope this helps a little bit?

Cor
 
Thanks Jorge & Cor.

I'm sure the answers I seek are in your posts.

I based the following comment:
#1, I found it discouraging that the Picture Box control did not support
Drag And Drop. Any thoghts here?

On the fact that controls such as the TextBox have an AllowDrop property and
the picture does not.

Ed
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top