Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Wednesday, August 15, 2007 4:18:34 AM(UTC)
imsachin

Groups: Registered
Posts: 4


Hi,  how do I display only the Wang supported annotations objects in the toolbar? I'd like to prevent users for selecting any other toolbar since we want to only support Wang annotations embedded in the TIFF file.

 

Tia!

 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Thursday, August 16, 2007 1:38:07 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,328

Was thanked: 1 time(s) in 1 post(s)

Hello,

LEADTOOLS SDK enables you to modify the toolbar and remove any button you don't want from it.
If you want more detail, please provide me with the following information:
What is the exact LEADTOOLS version (13, 14, 14.5, 15, etc.) that you use? Also, what is the exact LEADTOOLS programming interface (COM, OCX, API, .Net, C++ Class Library, etc.) that you use?

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#3 Posted : Thursday, August 16, 2007 9:58:16 AM(UTC)
imsachin

Groups: Registered
Posts: 4


I am using v15 of LeadTools in VB.net 2005.

Thanks!

 
#4 Posted : Monday, August 20, 2007 12:40:00 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,328

Was thanked: 1 time(s) in 1 post(s)

Hello,

The following code shows how to delete specific objects (RubberStamp and Encrypt objects) from the annotation toolbar:
+-----------------+
Public Class Form1
Private manager As AnnAutomationManager
Private codecs As RasterCodecs

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

RasterSupport.Unlock(RasterSupportType.Document, "Document Unlock key")

' create and set up the automation manager
...
manager = New AnnAutomationManager()
manager.CreateDefaultObjects()

Dim annobj As AnnAutomationObject

Dim i As Integer

For i = manager.Objects.Count - 1 To 0 Step -1

annobj = manager.Objects.Item(i)
If annobj.Id = AnnAutomationManager.RubberStampObjectId Or annobj.Id = AnnAutomationManager.EncryptObjectId Then
manager.Objects.Remove(annobj)
End If

Next

manager.CreateToolBar()
Controls.Add(manager.ToolBar)
...
End Sub
+-----------------+

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#5 Posted : Monday, August 20, 2007 4:45:03 AM(UTC)
imsachin

Groups: Registered
Posts: 4


Thanks. I'll give this a shot today and will post how it goes.
 
#6 Posted : Monday, August 20, 2007 8:42:07 AM(UTC)
imsachin

Groups: Registered
Posts: 4


Works perfectly.

[Y] Thanks for your help!

 
#7 Posted : Monday, September 1, 2008 6:02:05 PM(UTC)

roadman  
roadman

Groups: Registered
Posts: 29


hi, I tried to do it in the same way in C#, however, the object cannot be removed. Did i miss sth?

            AnnAutomationManager automationManager = null;
            AnnAutomation automation = null;
            RasterCodecs codecs = null;
            AnnAutomationObject annAutomationObj = null;

            automationManager = new AnnAutomationManager();
            automationManager.RasterCodecs = codecs;
            automationManager.RedactionRealizePassword = String.Empty;
            automationManager.UseXPStyleToolBar = true; // enable 14.5 new XP style toolbar -- must be called CreateDefaultObjects();
            automationManager.CreateDefaultObjects();

            for (int idx = 0; idx < automationManager.Objects.Count ; idx++)
            {
                annAutomationObj = automationManager.Objects[idx];
                if  (   (annAutomationObj.Id == AnnAutomationManager.RulerObjectId) ||
                        (annAutomationObj.Id == AnnAutomationManager.PolyRulerObjectId) ||
                        (annAutomationObj.Id == AnnAutomationManager.ProtractorObjectId) ||
                        (annAutomationObj.Id == AnnAutomationManager.StampObjectId) ||
                        (annAutomationObj.Id == AnnAutomationManager.AudioObjectId) ||
                        (annAutomationObj.Id == AnnAutomationManager.ButtonObjectId) ||
                        (annAutomationObj.Id == AnnAutomationManager.CrossProductObjectId) ||
                        (annAutomationObj.Id == AnnAutomationManager.HotspotObjectId) ||
                        (annAutomationObj.Id == AnnAutomationManager.FreehandHotspotObjectId) ||
                        (annAutomationObj.Id == AnnAutomationManager.PointObjectId) ||
                        (annAutomationObj.Id == AnnAutomationManager.RubberStampObjectId)
                       
                    )
                {
                    automationManager.Objects.Remove(annAutomationObj);
                }
            }

 
#8 Posted : Tuesday, September 2, 2008 3:03:50 AM(UTC)

Qasem Lubani  
Guest

Groups: Guests
Posts: 3,034

Was thanked: 1 time(s) in 1 post(s)


Did you get any error messages? Did you try to run the VB.NET code at your end? Did it work?
 
#9 Posted : Tuesday, September 2, 2008 5:31:43 AM(UTC)

roadman  
roadman

Groups: Registered
Posts: 29


I didn't try it in VB.NET
For C#.NET, there is no error returns
 
#10 Posted : Wednesday, September 3, 2008 1:18:56 AM(UTC)

roadman  
roadman

Groups: Registered
Posts: 29


I have run it in debug mode and everything works fine (the program can enter the "if-statement") with no error returns. However...no effect was taken after all statements completed. Do anyone has idea?

Instead of generation toolbars by CreateDefaultObjects(), can we get a default objects (say line object) and then add the object into the created toolbars?

 
#11 Posted : Wednesday, September 3, 2008 3:22:20 AM(UTC)

Qasem Lubani  
Guest

Groups: Guests
Posts: 3,034

Was thanked: 1 time(s) in 1 post(s)

I will take a look at the code and get back to you.
 
#12 Posted : Thursday, September 4, 2008 3:22:58 AM(UTC)

Qasem Lubani  
Guest

Groups: Guests
Posts: 3,034

Was thanked: 1 time(s) in 1 post(s)

Try the following code:

 RasterSupport.Unlock(RasterSupportType.Document, "XXXXXXXX");
         AnnAutomationManager automationManager ;
        
         RasterCodecs codecs = null;
         AnnAutomationObject annAutomationObj;

         automationManager = new AnnAutomationManager();
         automationManager.RasterCodecs = codecs;
         automationManager.RedactionRealizePassword = String.Empty;
         automationManager.UseXPStyleToolBar = true; // enable 14.5 new XP style toolbar -- must be called CreateDefaultObjects();
         automationManager.CreateDefaultObjects();
         
         for (int idx = 0; idx < automationManager.Objects.Count; idx++)
         {
            annAutomationObj = automationManager.Objects[idx];
            if ((annAutomationObj.Id == AnnAutomationManager.RulerObjectId) ||
                    (annAutomationObj.Id == AnnAutomationManager.PolyRulerObjectId) ||
                    (annAutomationObj.Id == AnnAutomationManager.ProtractorObjectId) ||
                    (annAutomationObj.Id == AnnAutomationManager.StampObjectId) ||
                    (annAutomationObj.Id == AnnAutomationManager.AudioObjectId) ||
                    (annAutomationObj.Id == AnnAutomationManager.ButtonObjectId) ||
                    (annAutomationObj.Id == AnnAutomationManager.CrossProductObjectId) ||
                    (annAutomationObj.Id == AnnAutomationManager.HotspotObjectId) ||
                    (annAutomationObj.Id == AnnAutomationManager.FreehandHotspotObjectId) ||
                    (annAutomationObj.Id == AnnAutomationManager.PointObjectId) ||
                    (annAutomationObj.Id == AnnAutomationManager.RubberStampObjectId)

                )
            {
               automationManager.Objects.Remove(annAutomationObj);
               
            }
         }

         automationManager.CreateToolBar();
         Controls.Add(automationManager.ToolBar);
      }
   }
 
#13 Posted : Thursday, September 4, 2008 4:34:20 AM(UTC)

roadman  
roadman

Groups: Registered
Posts: 29


The result is the same.

Do you mean the i have to unlock RasterSupportType.Document? if yes, is the serial no. the same as the multimedia SDK and the Medical Suite?
 
#14 Posted : Thursday, September 4, 2008 7:17:18 AM(UTC)

jigar  
Guest

Groups: Guests
Posts: 3,034

Was thanked: 1 time(s) in 1 post(s)

That code works for me too.  If you didn't unlock Document support then you would get an exception thrown, and you would not be able to create the toolbar or use any of the annotations at all.  Are you working with the EVAL version currently?  Create a new project and try that code in there.  If you are doing it in an existing project, there might be some other things involved that could be affecting it.
 
#15 Posted : Thursday, September 4, 2008 5:35:30 PM(UTC)

roadman  
roadman

Groups: Registered
Posts: 29


I have bought the Multimedia SDK and Medical Suit. I have also unlock these two suit using the given serials from LeadTools Sales.

I further found that the "Object.Remove" is not work for some annotation objects only. 
(annAutomationObj.Id == AnnAutomationManager.StampObjectId) || //not work
(annAutomationObj.Id == AnnAutomationManager.HotspotObjectId) || //not work
(annAutomationObj.Id == AnnAutomationManager.RulerObjectId) || //not work
(annAutomationObj.Id == AnnAutomationManager.ProtractorObjectId) ||  //not work

 

           AnnAutomationManager automationManager;

            RasterCodecs codecs = null;
            AnnAutomationObject annAutomationObj;

            automationManager = new AnnAutomationManager();
            RasterCodecs.Startup();
            codecs = new RasterCodecs();
            automationManager.RasterCodecs = codecs;
            automationManager.RedactionRealizePassword = String.Empty;
            automationManager.UseXPStyleToolBar = true; // enable 14.5 new XP style toolbar -- must be called CreateDefaultObjects();
            automationManager.CreateDefaultObjects();

            for (int idx = 0; idx < automationManager.Objects.Count; idx++)
            {
                annAutomationObj = automationManager.Objects[idx];
                if ((annAutomationObj.Id == AnnAutomationManager.TextRollupObjectId) ||
                    (annAutomationObj.Id == AnnAutomationManager.NoteObjectId) ||
                    (annAutomationObj.Id == AnnAutomationManager.StampObjectId) || //not work
                    (annAutomationObj.Id == AnnAutomationManager.RubberStampObjectId) ||
                    (annAutomationObj.Id == AnnAutomationManager.HotspotObjectId) || //not work
                    (annAutomationObj.Id == AnnAutomationManager.FreehandHotspotObjectId) ||
                    (annAutomationObj.Id == AnnAutomationManager.ButtonObjectId) ||
                    (annAutomationObj.Id == AnnAutomationManager.PointObjectId) ||
                    (annAutomationObj.Id == AnnAutomationManager.RulerObjectId) || //not work
                    (annAutomationObj.Id == AnnAutomationManager.PolyRulerObjectId) ||
                    (annAutomationObj.Id == AnnAutomationManager.ProtractorObjectId) ||  //not work
                    (annAutomationObj.Id == AnnAutomationManager.CrossProductObjectId) ||
                    (annAutomationObj.Id == AnnAutomationManager.EncryptObjectId) ||
                    (annAutomationObj.Id == AnnAutomationManager.AudioObjectId)
                    )
                {

                    automationManager.Objects.Remove(annAutomationObj);

                }
            }

            automationManager.CreateToolBar();
            automationManager.ToolBar.Dock = DockStyle.Right;
            automationManager.ToolBar.BringToFront();
            automationManager.ToolBar.AutoSize = true;
            Controls.Add(automationManager.ToolBar);

 

BTW, Can I create the toolbar first and then add the defaulted toolbar button one by one because I don't want to remove many buttons from the default toolbar , which may introduce some overheard on performance. In addition, I can customize the ordering of the annotation toolbar button.

 
#16 Posted : Friday, September 5, 2008 8:27:45 AM(UTC)

jigar  
Guest

Groups: Guests
Posts: 3,034

Was thanked: 1 time(s) in 1 post(s)

I'll answer your second question first.  You cannot create the toolbar first and then add the buttons.  You have to add them before calling CreateToolbar().  If you don't want to remove the buttons then you can create just the buttons you want manually, and in this case you should not call CreateDefaultObjects().

Now the reason why it's not removing some of the objects is because it keeps on incrementing the idx value when an object is removed.  To give a small example, lets say you have a list, and you have 3 objects inside: A, B, and C.  The Count value for the list is 3.  Let's say you want to remove B and C from the list.  If you remove the item at index 1, then you are left with A, C.  Since you removed an item you don't want to increment the position to the next element because the list has gotten shorter (Count = 2).

So change your for loop to this:

            for (int idx = 0; idx < annMgr.Objects.Count; /* see code in else statment below */ )
            {
                annAutoObj = annMgr.Objects[idx];
                if ((annAutoObj.Id == AnnAutomationManager.RulerObjectId) ||
                        (annAutoObj.Id == AnnAutomationManager.PolyRulerObjectId) ||
                        (annAutoObj.Id == AnnAutomationManager.ProtractorObjectId) ||
                        (annAutoObj.Id == AnnAutomationManager.StampObjectId) ||
                        (annAutoObj.Id == AnnAutomationManager.AudioObjectId) ||
                        (annAutoObj.Id == AnnAutomationManager.ButtonObjectId) ||
                        (annAutoObj.Id == AnnAutomationManager.CrossProductObjectId) ||
                        (annAutoObj.Id == AnnAutomationManager.HotspotObjectId) ||
                        (annAutoObj.Id == AnnAutomationManager.FreehandHotspotObjectId) ||
                        (annAutoObj.Id == AnnAutomationManager.PointObjectId) ||
                        (annAutoObj.Id == AnnAutomationManager.RubberStampObjectId)
                    )
                {
                    annMgr.Objects.Remove(annAutoObj);
                }
                else
                {
                    // Only increment if we DON'T remove an object.
                    idx++;
                }
            }

 
#17 Posted : Friday, September 5, 2008 6:45:53 PM(UTC)

roadman  
roadman

Groups: Registered
Posts: 29


Thank for your detailed explaination!

Do you mean that i have to add my button manually same as the "CreateMyAutomationObjects" in the example of the AnnAutomationManager?

It seem that it needs a number of steps to setup the button's appearance.
e.g // set up the line automation object ....

Is there any defaulted button so that i don't need to setup
 
#18 Posted : Monday, September 8, 2008 7:34:30 AM(UTC)

jigar  
Guest

Groups: Guests
Posts: 3,034

Was thanked: 1 time(s) in 1 post(s)

No, we don't have any default buttons.  Our CreateDefaultObjects() does the same thing internally as the CreateMyAutomationObjects example.  So you just have to follow that example.
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2020, Yet Another Forum.NET
This page was generated in 0.892 seconds.