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 : Sunday, April 16, 2017 4:59:38 PM(UTC)
wangbill18

Groups: Registered
Posts: 45


Hi team,

This code used to work under annotation.dll, now since it is deprecated, I am trying to move to annotation.core.dll, problem is annotations disappear after rotate.. please help. I am using latest V19

Code:
Private Sub ToolStripButtonRotateStamps_Click(sender As Object, e As EventArgs) Handles ToolStripButtonRotateStamps.Click
        For j As Integer = _annAutomation.Container.Children.Count - 1 To 0 Step -1
            _annAutomation.Container.Children(j).Rotate(-90, _annAutomation.Container.Children(j).RotateCenter)
        Next
        _imageViewer.Invalidate()
    End Sub

Edited by moderator Monday, April 17, 2017 8:29:22 AM(UTC)  | Reason: Not specified

 

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 : Wednesday, April 19, 2017 7:37:22 PM(UTC)
wangbill18

Groups: Registered
Posts: 45


Please help!! Sometime, stamps are rotated but old ones stay so I have two...
 
#3 Posted : Thursday, April 20, 2017 9:25:04 AM(UTC)

Hadi  
Hadi

Groups: Manager, Tech Support, Administrators
Posts: 171

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

Hello,

I have tested this and it works fine for me. Attached is the project that I tested with.

In your code, can you check what the size of your _annAutomation.Container is?

I attached the project I tested this with.

File Attachment(s):
SimpleWinformsAnnotations.zip (12kb) downloaded 203 time(s).
Hadi Chami
Developer Support Manager
LEAD Technologies, Inc.

LEAD Logo
 
#4 Posted : Wednesday, April 26, 2017 8:06:04 PM(UTC)
wangbill18

Groups: Registered
Posts: 45


Hi Hadi, I found my issue is if stamp rotation is going to cause stamp to cross container boundary, the stamp will disappear, when I look at the ann object, its bounds shows NaN,NaN,NaN,NaN.. Can you help?
 
#5 Posted : Thursday, April 27, 2017 1:46:58 PM(UTC)

Hadi  
Hadi

Groups: Manager, Tech Support, Administrators
Posts: 171

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

You can turn on the AnnAutomationManager property Restrict Designers to prevent the object from being drawn outside the container.

https://www.leadtools.co...r-restrictdesigners.html

Code:
annManager = new AnnAutomationManager()
{
  RestrictDesigners = true
};


If this doesn't work for you, can you modify my previous project to show the issue you are seeing or can you attach a small sample application for me to debug and provide a workaround?
Hadi Chami
Developer Support Manager
LEAD Technologies, Inc.

LEAD Logo
 
#6 Posted : Thursday, April 27, 2017 11:49:58 PM(UTC)
wangbill18

Groups: Registered
Posts: 45


That was not the problem. my annobject is added by code, if I click it after it is added, rotate will work fine. if I don't click it after it is added, it will disappear. I tried in your code, it has the same problem. You can add code below to your project to recreate my problem.

annAutomation.Container.Size = annAutomation.Container.Mapper.SizeToContainerCoordinates(imageViewer.ImageSize.ToLeadSizeD());

AnnTextObject annText = new AnnTextObject();
annText.Text = "TEST ROTATE";
annText.Font = new AnnFont("Tahoma", 10);
annText.Rect = new LeadRectD(720 * 2, 720 * 1, 720 * 2, 720 * 1);
annAutomation.Container.Children.Add(annText);
 
#7 Posted : Friday, April 28, 2017 8:20:25 AM(UTC)

Hadi  
Hadi

Groups: Manager, Tech Support, Administrators
Posts: 171

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

Thank you for providing the code to reproduce the issue.

I looked into this, and the issue is that the objects Rotate Center is never actually set when added programmatically. Which was causing the Rotate to rotate about an empty point (0,0).

To resolve this, you can either add the rotate center into your code like so:

Code:
         AnnTextObject annText = new AnnTextObject();
         annText.Text = "TEST ROTATE";
         annText.Font = new AnnFont("Tahoma", 10);
         annText.Rect = new LeadRectD(720 * 2, 720 * 1, 720 * 2, 720 * 1);
         annText.RotateCenter= new LeadPointD(annText.Bounds.X + (annText.Bounds.Width / 2), annText.Bounds.Y + (annText.Bounds.Height / 2));


Or you can do a check in the Rotate Code itself to make sure the rotate center is set:

Code:
      void RotateAnns()
      {
         foreach(var obj in annAutomation.Container.Children)
         {
            LeadPointD center = new LeadPointD(obj.Bounds.X + (obj.Bounds.Width / 2), obj.Bounds.Y + (obj.Bounds.Height / 2));
            obj.RotateCenter = obj.RotateCenter != LeadPointD.Empty ? obj.RotateCenter : center;
            obj.Rotate(-90, obj.RotateCenter);
         }
         annAutomation.Invalidate(LeadRectD.Empty);
      }
Hadi Chami
Developer Support Manager
LEAD Technologies, Inc.

LEAD Logo
 
#8 Posted : Friday, April 28, 2017 8:20:38 PM(UTC)
wangbill18

Groups: Registered
Posts: 45


Thanks, that worked.
 
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-2017, Yet Another Forum.NET
This page was generated in 0.212 seconds.