CODE to COPY DATA TABLE as IMAGE (rather than as TEXT) . . .
2018-11-20-170131
I typed up a really pretty version of this question with code examples and everything and the FORUM seems to have eaten my homework.
This version is a bit more terse.
Is there CODE that will create an IMAGE of the DATA TABLE?
I think something like
ThisApplication.Panels.Control("DataTable").DrawToBitmap
might do but I cannot find enough information on the Panels.Control and DrawToBitmap to figure this out.
I would like to get a copy of the DATA TABLE as PIXELS so I can paste them into the IMAGE WINDOW next to the IMAGE PIXELS.
Can this be done?
Thanks.
-- Matt
0
Comments
-
2018-11-20-171605All --I occurred to me to me to search within the FORUM for theDrawToBitmapIn doing so, I found the following code from NIKITA within a discussion.
Public Sub GetDesignerImage For Each f As System.Windows.Forms.Form In System.Windows.Forms.Application.OpenForms GetDesignerControl(f) Next End Sub Private Sub GetDesignerControl(c As System.Windows.Forms.Control) If c IsNot Nothing AndAlso c.Visible Then If c.GetType.ToString = "DevComponents.AdvTree.AdvTree" Then Dim b As New System.Drawing.Bitmap(c.Width, c.Height) c.DrawToBitmap(b, New System.Drawing.Rectangle(0, 0, c.Width, c.Height)) b.Save("C:\" & Now.Ticks & ".bmp") End If For Each c2 As System.Windows.Forms.Control In c.Controls GetDesignerControl(c2) Next End If End Sub
When I runGetDesignerImageI get the following error.This error does not seem to be an IMPORT / REFERENCE ERROR.What is the best way to proceed?Thanks.-- Matt
0 -
Hi Matt,
You were almost there, the main issue is to get the right panel name. The easiest way is to get it from Gadgets command.
Here is the codePublic Sub SaveTableScreenshot Dim panelName As String 'be sure the table is visible With Measure.Measurements.Gadgets.DataTable(Nothing) .CheckState = MediaCy.IQL.Application.McCommand.mcCheckState.Checked .Run() 'get panel name panelName =.PanelName End With SaveToBMP(ThisApplication.Panels.Control(panelName),"DataTable") End Sub Private Sub SaveToBMP(c As System.Windows.Forms.Control, caption As String) If c IsNot Nothing AndAlso c.Visible Then Dim b As New System.Drawing.Bitmap(c.Width, c.Height) c.DrawToBitmap(b, New System.Drawing.Rectangle(0, 0, c.Width, c.Height)) Dim fn As String=ThisApplication.Path(mcPathType.mcptWritableImages) & caption & ".bmp" b.Save(fn) End If End Sub
Yuri0 -
2018-11-29-1410
Yuri --
Thank you for working through this and responding.
The customer is working with V1A version of the software now.
I will try this CODE out ASAP and implement it when if his review requires any CODE modifications.
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