Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

ControlImage with Delphi 3.0

I use CWgraph, to edit datas on the screen.
And I would like to be able to save and/or print the Graph at the end of the acquisition. To do so, I have tried to use the ControlImage Methode of CWGraph, but the return type is "Picture", and to use SaveToFile function, I need the TPicture type, what can I do?

Thanks for all!
0 Kudos
Message 1 of 3
(3,730 Views)
Hello Mathias,
I do not use Delphi, and I am not familiar with the TPicture data type. However, the Picture returned by the ControlImage Method is of the OLE Picture datatype (a standard ActiveX datatype). To print in VB is as simple as:
Call Printer.PaintPicture(CWGraph1.ControlImage, 0, 0)

You may have better success by asking a Delphi newsgroup how to convert an OLE Picture to a TPicture. If you find out, we would appreciate it if you would repost the answer here.

Jeremiah Cox
Applications Engineer
National Instruments
http://www.ni.com/ask
0 Kudos
Message 2 of 3
(3,730 Views)
You can use the setOlePicture method from the AXCtrls unit like this:

var myPicture : TPicture;
...
begin
myPicture := TPicture.Create();
SetOlePicture(myPicture, CWGraph1.ControlImage);
..
// Do your job with myPicture (For example display it in a TImage, be sure to set the Stretch property to true, else you wan't see a thing).
..
myPicture.free;
end;
0 Kudos
Message 3 of 3
(3,730 Views)