by Shane » Fri Nov 04, 2011 7:29 pm
I've downloaded GDPicture 8.4 and I'm trying to add static image annotations to a page. I can get one to work, but how do I add more than one image annotation on the same page. Let's say on a menu I have 3 options and each option will add a static image annotation on the same TIFF page, I can only get it to work with one static annotation on a TIFF page, How do I get add more static annotations to a TIFF page everytime I select a menu option. In the example below it seems that everytime I pass the .InitFromGDPictureImage(ImageID) from another menu method the current annotation disappears.
Example:
private void annotCutoffToolStripMenuItem_Click(object sender, EventArgs e)
{
GdPictureImaging oGdPictureImaging = new GdPictureImaging();
int ImageID = oGdPictureImaging.CreateGdPictureImageFromFile(Path.GetDirectoryName(Application.ExecutablePath).Replace("bin\\Debug", "") + "TEMPLATE_orig.tif");
//int ImageID = oGdPictureImaging.CreateGdPictureImageFromHwnd(GdViewer1.Handle);
/AnnotationManager oAnnotationManager = new AnnotationManager();
oAnnotationManager.InitFromGdPictureImage(ImageID );
oAnnotationManager.SelectPage(1);
string FilePath = Path.GetDirectoryName(Application.ExecutablePath).Replace("bin\\Debug", "") + "media\\cutoff.jpg";
Bitmap Bm;
int jpgImageID = oGdPictureImaging.CreateGdPictureImageFromFile(FilePath);
float left_pix = (float)(300 / oGdPictureImaging.GetVerticalResolution(ImageID ));
float top_pix = (float)(400 / oGdPictureImaging.GetVerticalResolution(ImageID ));
float width_pix = (float)(245 / oGdPictureImaging.GetVerticalResolution(ImageID ));
float height_pix = (float)(178 / oGdPictureImaging.GetVerticalResolution(ImageID ));
Bm = oGdPictureImaging.GetBitmapFromGdPictureImage(jpgImageID);
AnnotationEmbeddedImage annot1 = oAnnotationManager.AddEmbeddedImageAnnot(Bm, left_pix, top_pix, width_pix, height_pix);
annot1.CanResize = false;
oAnnotationManager.Close();
GdViewer1.DisplayFromGdPictureImage(ImageID );
}
any help would be appreciated.
Thanks,