#1
Posted
:
Sunday, April 16, 2017 4:54:38 PM(UTC)
Groups: Registered
Posts: 50
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:24:22 AM(UTC)
| Reason: Not specified
#2
Posted
:
Wednesday, April 19, 2017 7:32:22 PM(UTC)
Groups: Registered
Posts: 50
Please help!! Sometime, stamps are rotated but old ones stay so I have two...
#3
Posted
:
Thursday, April 20, 2017 9:20:04 AM(UTC)
Groups: Manager, Tech Support, Administrators
Posts: 218
Was thanked: 12 time(s) in 12 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.
Hadi Chami
Developer Support Manager
LEAD Technologies, Inc.
#4
Posted
:
Wednesday, April 26, 2017 8:01:04 PM(UTC)
Groups: Registered
Posts: 50
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:41:58 PM(UTC)
Groups: Manager, Tech Support, Administrators
Posts: 218
Was thanked: 12 time(s) in 12 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.htmlCode: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.
#6
Posted
:
Thursday, April 27, 2017 11:44:58 PM(UTC)
Groups: Registered
Posts: 50
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:15:25 AM(UTC)
Groups: Manager, Tech Support, Administrators
Posts: 218
Was thanked: 12 time(s) in 12 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.
#8
Posted
:
Friday, April 28, 2017 8:15:38 PM(UTC)
Groups: Registered
Posts: 50
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.