Home Image-Pro Automation (Macros, Apps, Reports)

DataGridView Control and DrawToBitmap Method . . .


All --

I am working on a project that includes a DataGridView Control.

I have the code for the DataGridView doing most of the things that I want via examples on the INTERNET.

I have seen on the INTERNET that there is a DrawToBitmap Method for the VB.NET implementation of the DataGridView Control that will create an image of the DataGridView Control as shown here.

    'Create a Bitmap and draw the DataGridView on it.
    Dim bitmap As Bitmap = New Bitmap(dataGridView1.Width, dataGridView1.Height)
    dataGridView1.DrawToBitmap(bitmap, New Rectangle(0, 0, dataGridView1.Width, dataGridView1.Height))
    'Save the Bitmap to folder.

I have partially converted this SUB to the CODE required by the IMAGE-PRO WORKBENCH but I am unable to work through the implementation or conversion of the


and I would like to replace the SAVE THE BITMAP TO FOLDER with a PASTE BITMAP INTO ACTIVE IMAGE.

I believe that once I get the BITMAP of the DataGridView, I can use a


to get the BITMAP onto the WINDOWS CLIPBOARD and then I can something like

        With Adjust.ImageCommands.ClipboardPaste(PasteImage)
            .Location = New System.Drawing.Point(1207,-6)
        End With

to put the pixels in the BITMAP on the CLIPBOARD into the ACTIVE IMAGE-PRO IMAGE.
Is there a DATA TYPE in the PROJECT WORKBENCH that I can use to replace RECTANGLE or is the a REFERENCE that I can use to add the RECTANGLE TYPE to the WORKBENCH?

Is there a better way to transfer a BITMAP of the DATAGRIDVIEW from the USER INTERFACE into the IMAGE?


-- Matt


  • Hi Matt,

    Regarding types: when you check samples on internet, they may have Imports section at the top of the file or direct mentioning of what class they are using. With regards to "Rectangle", you can just specify full type: System.Drawing.Rectangle.

    And then you can use clipboard as System.Windows.Forms.Clipboard.SetImage(bitmap)


  • 2020-10-16-142754

    Yuri --

    Thanks for the guidance.

    I was tinkering with this feature a couple of days ago and hope to get it operational but it is on the WISH LIST and not the NEED LIST.  After I address everything on the NEED LIST, I will come back and work to include this.

    Thanks again.

    -- Matt

Sign In or Register to comment.