Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

custom points

By all means.  Thank you for listening.
0 Kudos
Message 11 of 26
(4,928 Views)

Hi Sof,

Back to the Active X approach ....

The image for the annotation should located at a URL (possibly a location on your hard drive).  You can modify that picture (you can call GetURL if you need to get the location of the URL programmatically), and then call Reload() on your image. 

Here are some code snippets for C++:

m_GraphData.Annotations.Item(1).Shape.Type = CNiShape::Picture;

m_GraphData.Annotations.Item(1).Shape.Image.Url =

"c:\\image.bmp";

m_GraphData.Annotations.Item(1).Shape.Image.BlinkInterval = CNiImage::SpeedOff;

m_GraphData.Annotations.Item(1).Shape.Image.Reload;

CNiImage myImage = m_GraphData.Annotations.Item(1).Shape.GetImage();

Cheers,

David Goldberg
National Instruments
Software R&D
0 Kudos
Message 12 of 26
(4,926 Views)

Oh yea, I forgot the original intention of the post. Smiley Very Happy

I'm not sure I'm following you.  Your code snippet sets the Shape image, loads it, and gets it.  But once I get the CNiImage how can I modify the bitmap?  The image is still an CNiPicture, which as far as I can tell, doesn't do me alot of good. 

What I need to do is:

1. get the image of the annotation
2. do my custom mods to the annotation image
3. assign that image back to that annotation image

Thanks,
Scott

0 Kudos
Message 13 of 26
(4,920 Views)

Hi Scott,

These is a predefined set of images that will be displayed for the annotations, right?  It seems like the best way would be to programmatically switch one image out for another.  For example, if you had a set of image files that are different colored squares, you could replace the image with another one in that set.   

Cheers,

David Goldberg
National Instruments
Software R&D
0 Kudos
Message 14 of 26
(4,919 Views)
Hi Scott,
 
Also, CWImage allows for some basic image operations, such as:
 
AnimateColumns Specifies the number of columns in a bitmap that is being used for animation.
AnimateInterval Specifies how often an image animates.
AnimateRows Specifies the number of rows in a bitmap that is being used for animation.
BlinkInterval Specifies how often the image blinks.
Color Specifies the color of the image, or, if you are doing dynamic color substitution in Windows metafiles, the color in the image that you want to replace.
FlipH Flips an image horizontally.
FlipV Flips an image vertically.
Picture Specifies the image used in the CWImage object.
ReverseAnimation Specifies the direction of animation.
SaveLink Specifies if the CWImage object saves the image itself or a link to the image.
Stretch Specifies if the image is displayed normal size or stretched to fit the size available within the control.
Substitute Specifies that you want to perform dynamic color substitution in the metafile image if set to True.
SubstituteColor Specifies the color that will replace a specified color in the metafile image.
Tile Specifies if the image is tiled.
Tolerance Specifies the percentage for matching color hues on the image to the SubstituteColor property.
Transparent Specifies if the image has a transparent color.
TransparentColor Specifies the color in the image that must be drawn as transparent.
URL Specifies the path to the image.
Visible

Specifies if the image is visible or not.

 

In particular, color will let you change the color of the picture.  Another option is to use a native .NET library (you already have the saved file, so you can load it and do any image processing on it).  An example .NET program (including source code) is:  http://www.getpaint.net/

Cheers,

David Goldberg
National Instruments
Software R&D
0 Kudos
Message 15 of 26
(4,917 Views)

I tried this but it did not change the color in my wmf from Red to Blue.  I tried setting different tolerances from 0-100 and nothing worked.  If I could get this working that would solve my problem.

_Anno.Shape.Image.CWImage.URL =

@"C:\Users\DevAccount\Desktop\TriangleWMF.wmf";
_Anno.Shape.Image.CWImage.Reload();
_Anno.Shape.Image.CWImage.Substitute =
true;
_Anno.Shape.Image.CWImage.Color = (
uint)ColorTranslator.ToWin32(Color.Red);
_Anno.Shape.Image.CWImage.SubstituteColor = (
uint)ColorTranslator.ToWin32(Color.Blue);

0 Kudos
Message 16 of 26
(4,908 Views)
Thanks, Sof.  I am looking into this further. 
Cheers,

David Goldberg
National Instruments
Software R&D
0 Kudos
Message 17 of 26
(4,892 Views)

Hi Sof,

This was reported to R&D (4CUMHLNM) for further investigation.  For now, you may want to try a .NET Library to change the color of the image, using the info I suggested in an earlier post.

Cheers,

David Goldberg
National Instruments
Software R&D
0 Kudos
Message 18 of 26
(4,868 Views)
So is there going to be a hot-fix for this?  You all advertise that these things work and then you yourselves find out that they don't!
 
We need this functionality.  Your solution from a previous post is impractical. 
0 Kudos
Message 19 of 26
(4,836 Views)
Hi Scott,

We apologize for the fact that the basic code snippet you posted just doesn't work.  The bug report has been filed by David to us so we do have this issue in our database.

Now in the mean time, a suitable workaround needs to be used and thus I am wondering why you mentioned that David's workaround is impractical.  Could you please elaborate and explain your reasoning behind this?  It seems (and please correct me on this) that you are simply trying to manipulate an image. If this is true, as David mentioned, you could use any of the .NET libraries that allow you to manipulate image objects.  The System.Drawing namespace includes many classes that you can use to manipulate images and graphic objects.

Maybe you are doing something more complicated that I am assuming but even if that's the case, I would tend to lean towards the .NET classes as a workaround. 

Best Regards,
Jonathan N.
National Instruments
0 Kudos
Message 20 of 26
(4,834 Views)