DataGridView Control and DrawToBitmap Method . . .
2020-10-16-095812
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.
Dim bitmap As Bitmap = New Bitmap(dataGridView1.Width, dataGridView1.Height)
dataGridView1.DrawToBitmap(bitmap, New Rectangle(0, 0, dataGridView1.Width, dataGridView1.Height))
bitmap.Save("D:\Images\DataGridView.png")
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
RECTANGLE DATA TYPE
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
System.Windows.Clipboard.SetImage
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)
.Run()
End With
.Location = New System.Drawing.Point(1207,-6)
.Run()
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?
Thanks.
-- Matt
0
Comments
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)
Yuri