bendataclear
bendataclear

Reputation: 3848

Copying a datagridview image column as part of a table

I have a data grid view which is bound to a list of classes. The data grid view includes an image column (DataGridViewImageColumn) which is bound to a Byte() datatype in the class.

Image Column Screenshot

I am copying data from the DataGridView to several other places (MS Excel/Outlook/Plain Text) however when I do the image column is obviously blank.

I can just copy the image data to the clipboard manually for a single image but is there any way I can include this image column in the data table copied to the clipboard?

Alternatively is there a way I can manually construct the clipboard data to include the images?

I've had a look through the clipboard formats listed on msdn but I can't see one that could include all this information.

If it helps, the simplified class definition:

Public Class Booking

    Public Property bookingID As Integer
    ...
    Public Property identString As String
    Public Property image As Byte() ' <--- My Image Column
    Public Property complete As Boolean
    ...
    Public Property bookedInDate As DateTime?
    Public Property bookedOutDate As DateTime?

End Class

Upvotes: 1

Views: 621

Answers (1)

xpda
xpda

Reputation: 15813

You can define your own clipboard format (either private or registered) and use a data handle.

http://msdn.microsoft.com/en-us/library/windows/desktop/ms649013%28v=vs.85%29.aspx#_win32_Private_Clipboard_Formats

Depending on your application, it might be easier to use some kind of indirection, such as a pointer(s) in the clipboard to the images.

Upvotes: 1

Related Questions