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
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 code
Public 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
Yuri
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