Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I use the 3D graph Active X control within .Net

Hi
 
I am currently evaluating Measurement Studio for a new project and am primarily interested in graphing capabilities.
 
Can I use the 3d Graph ActiveX with Visual Basic.Net
 
Other posts suggest I can but the help file indicates that this control expects arrays of type variant for plot data and I believe that the variant data type is not supported under .net
 
I want to use the control with full functionality eg pan zoom rotate, cursors etc so full and correct functionality is important
 
Any help will be appreciated
 
Paul
0 Kudos
Message 1 of 12
(7,293 Views)

You can use the 3D graph in VB.NET. Whenever you use ActiveX controls in .NET, you actually use them through a .NET COM-interop wrapper. The interop wrapper interface will use the .NET System.Object type in place of variants. .NET's COM interop will handle converting the .NET type to the corresponding variant type when you use the interop wrapper.

- Elton

0 Kudos
Message 2 of 12
(7,281 Views)
I have attached an example that uses the 3D Graph in VB.NET. It should give you an idea of the programming experience for the 3D Graph in VB.NET.
0 Kudos
Message 3 of 12
(7,278 Views)

Thanks folks

One more question-

I would also like to know if Measurement studio ocx's (particularly the graph controls and other UI controls) are usable within a Delphi environment

 

Thanks in advance

Paul

0 Kudos
Message 4 of 12
(7,269 Views)

Hi there Paul,

Measurement Studio controls are 32-bit ActiveX controls that are designed to work in any ActiveX-compliant control container. However, some containers do not work with the functionality required by our controls. For example, Borland C++ Builder and Delphi do not handle ActiveX controls developed using Visual Basic

Please let me know if there is anything else

Thanks

Katherine Robinson

Technical Support - National Instruments (UK)

Applications Engineer
National Instruments (UK)
www.ni.com/support
0 Kudos
Message 5 of 12
(7,258 Views)

Hi

Well I have tried importing your evaluation version of cwgraph3d into a Delphi project and it seems to work fine

I cannot however find a way to print the control image.

I have been told that our project will be developed with delphi ( company wide policy)

So I understand that you dont support delphi but if anyone knows how to do this in delphi we can go ahead and use measurement studio, otherwise we have to find an alternative.

Any ideas gratefully received.

Paul

0 Kudos
Message 6 of 12
(7,234 Views)

The controlimage and controlimageex methods return an image of the control. I have not used Delphi before, but here is how you might use those methods in VB

'Set the image of the picturebox control in VB to
'an image of the entire graph
Set Picture1.Picture = CWGraph3D1.ControlImage

I hope this helps



Bilal Durrani
NI
0 Kudos
Message 7 of 12
(7,222 Views)

Sorry folks, another question.

When rotating a graph, the text on the axes becomes reversed, I know that this would be expected but other vendors seem to handle this correctly, is there a way to correct this?

 

Paul K

 

0 Kudos
Message 8 of 12
(7,206 Views)
Paul,

Attached is a small application in Delphi 7 that plots random values to a 3d graph and prints it.

Here is the code for printing.
 
procedure TForm1.PrintBtnClick(Sender: TObject);
var
  picture : TPicture;
  dpiX, dpiY : Integer;
  rect : TRect;
begin
  {Get the resolution of the printer}
  dpiX := GetDeviceCaps(Printer.Handle, LOGPIXELSX);
  dpiY := GetDeviceCaps(Printer.Handle, LOGPIXELSY);

  {Get the image from the 3d Graph that is appropriate for the
  printer resolution using the ControlImageEx method}
  picture := TPicture.Create;
  SetOlePicture(picture, CWGraph3D1.ControlImageEx(dpiX, dpiY));

  {Calculate scaled rectangle for differences in Screen and Printer
  resolution}
  rect.Left := 0;
  rect.Top := 0;
  rect.Right := round(picture.Width * dpiX/Screen.PixelsPerInch);
  rect.Bottom := round(picture.Height * dpiX/Screen.PixelsPerInch);

  {Print the image}
  Printer.BeginDoc;
  Printer.Canvas.StretchDraw(rect, picture.Graphic);
  Printer.EndDoc;

  {Cleanup}
  FreeAndNil(picture);
end;

Mahesh.
 
Disclaimer: I dabble in Delphi but I am not an expert.

Message Edited by mahesh on 08-22-2005 07:19 AM

0 Kudos
Message 9 of 12
(7,166 Views)

Thanks Mahesh

Any chance you know what to about the axis labels when rotating, other tools I have seen display these correctly nomatter how you rotate the graph but the NI control rotates the labels as well making the graph unreadable or giving no point to printing the graph if rotated.

Thanks

 

Paul

0 Kudos
Message 10 of 12
(7,159 Views)