Image as Thumbnail in Data Grid?

I did a search through the knowledgebase, but couldn't find anything about this. I have a SQL Database, and want to display an image as a thumbnail in one of the data fields. I cannot figure out how to do this, but figure it must be possible. Any help would be greatly appreciated. I would like it to take a large image and resize it automatically for the thumbnail, but don't want to impact performance too badly, so any suggestions would be greatly appreciated.

Thanks,
-Matt


Answer this question

Image as Thumbnail in Data Grid?

  • Bowljoman

    Thank you for the help. What do you mean by Dim as a image

    Thanks Again,
    -Matt

  • GNLuver

    Load the file into an Image or picture (it doesn't have to be displayed).

    Dim a as Image = YOURIMAGE ' From SQL

    System.Drawing.Image.GetThumbnailImage(Integer, Integer, System.Drawing.Image.GetThumbnailImageAbort, System.IntPtr)

    http://msdn2.microsoft.com/en-US/library/system.drawing.image.getthumbnailimage.aspx



  • Grae Foster

    Thanks, I'll try this and see what happens. Thanks a lot for the help. :)

    Thanks,
    -Matt

  • Trish

    That's not what the code said.

    I was giving you an example.

    You need to instantiate an image class as a class.

    You need to get your sql data into it and convert it into a thumbnail.

    System.Drawing.Image.GetThumbnailImage(Integer, Integer, System.Drawing.Image.GetThumbnailImageAbort, System.IntPtr)

    GetThumbnailImage is asynchronous so it will have two parts.

    1.) the request - System.Drawing.Image.GetThumbnailImage

    2.) The io completion routine which will be called when the conversion is complete and where you will be able to get the thumbnail image and place it in your control.

    Since it's asynchronous, the conversion will not effect your apparent performance. If you have a uni processor system, depending on the processor it will require compute recources that may of may not be perceivable to you. That depends on a number of hardware related factors.

    In order to implement the I/O completion routine, you will have to create a delegate method and include and Intptr adddress to the routine as the last argument in System.Drawing.Image.GetThumbnailImage.



  • Image as Thumbnail in Data Grid?