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
-
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)
Yuri
0 -
2020-10-16-142754Yuri --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
0
Categories
- All Categories
- 961 Image-Pro v9 and higher
- 9 Image-Pro FAQs
- 18 Image-Pro Download & Install
- 448 Image-Pro General Discussions
- 486 Image-Pro Automation (Macros, Apps, Reports)
- 20 AutoQuant Deconvolution
- 2 AutoQuant Download & Install
- 18 AutoQuant General Discussions
- 195 Image-Pro Plus v7 and lower
- 3 Image-Pro Plus Download & Install
- 106 Image-Pro Plus General Discussions
- 86 Image-Pro Plus Automation with Macros
- 19 Legacy Products
- 16 Image-Pro Premier 3D General Discussions
- 26 Image-Pro Insight General Discussions