Thanks for responding. I did as you suggested and created a new project/etc
and tried your code. I can now properly size the box, but the image problem
still persists. It still throws an exception on the first 'Shape.Image'
attribute accessed, but it is now caught by AfxCallWndProc(). Also, a new
popup box is now displayed showing "SCODE: -2147467262". This may be
unrelated as it does not show up in my original program even if I swap in
your code segment. I am using Measurement Studio version 6. Any further
ideas would be greatly appreciated. Thanks.
"Elton Wells" wrote in message
news:50650000000500000073240100-1042324653000@exchange.ni.com...
> It might be the way that you're specifying the coordinates. When
> specifying the coordinates for an image, you only need to specify 2
> values for the X & Y coordinate vectors that indicate the starting
> point and width/height rather than 5 values for the the 4 corners and
> closing point. For example, create a new project, add a graph, create
> a member variable called m_graph, add a button, double-click on the
> button, and add the following code. Assuming that you have a file on
> your system at C:\Windows\WINNT.bmp (XP systems will have this), you
> should see be able to run, click the button, and see the image
> annotation:
>
> CNiAnnotation annotation = m_graph.Annotations.Add();
> annotation.Shape.Type = CNiShape::Picture;
>
> const int imageWidth = 275;
> const int imageHeight = 174;
>
> // Create coordinates for the top-left corner of plot area.
> CNiReal64Vector xCoordinates(2), yCoordinates(2);
> xCoordinates[0] = 0;
> xCoordinates[1] = imageWidth;
> yCoordinates[0] = 0;
> yCoordinates[1] = imageHeight;
> annotation.CoordinateType = CNiAnnotation::PlotAreaCoordinates;
> annotation.Shape.XCoordinates = xCoordinates;
> annotation.Shape.YCoordinates = yCoordinates;
>
> annotation.Shape.Image.Url = _T("C:\\Windows\\WINNT.bmp");
> annotation.Shape.Image.Reload();
>
> - Elton