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, February 11, 2009 10:55:36 PM(UTC)

ssskkk  
ssskkk

Groups: Registered
Posts: 74


hello,

      My application is  a Windows Based application using c#.net 2008 and .net framework is 3.5 and also use leadtools version 16.In my application ,have one rasterimageviewer , it will dispaly a image and button name, rectangle. I wrote the code for this is given below ,but the result was

after cliking reactangle toobar , then i can draw the rectangle.But i want no need of cliking the toolbar (rectangle) and can be drawn only cliking the button.

manager = new AnnAutomationManager();

// Create only the line and rectangle automation objects

CreateMyAutomationObjects(manager);

// You can instruct the manager to create the default (all) automation objects.

// comment out the call to CreateMyAutomationObjects and call this instead:

//theManager.CreateDefaultObjects();

// create the toolbar and add it to the form

manager.CreateToolBar();

Controls.Add(manager.ToolBar);

// set up the automation (will create the container as well)

AnnAutomation automation = new AnnAutomation(manager, rasterImageViewer2 );

// set up this automation as the active one

automation.Active = true;

}

private void CreateMyAutomationObjects(AnnAutomationManager manager)

{

// set up the select automation object

AnnAutomationObject selObj = new AnnAutomationObject();

selObj.Id = AnnAutomationManager.RectangleObjectId;

MessageBox.Show("Value is" + selObj.Id );

// create the toolbar button (or you can load the image from a disk file or resource)

Bitmap btmp = new Bitmap(16, 16);

 

// set up the rectangle automation object

AnnAutomationObject rectObj = new AnnAutomationObject();

rectObj.Id = AnnAutomationManager.RectangleObjectId;

rectObj.Name = "Rectangle";

AnnRectangleObject rect = new AnnRectangleObject();

rect.Pen = new AnnPen(Color.Red, new AnnLength(1, AnnUnit.Pixel));

rect.Brush = new AnnSolidBrush(Color.White);

rectObj.Object = rect;

rectObj.DrawDesignerType = typeof(AnnRectangleDrawDesigner);

rectObj.EditDesignerType = typeof(AnnRectangleEditDesigner);

rectObj.RunDesignerType = typeof(AnnRunDesigner);

btmp = new Bitmap(16, 16);

using (Graphics graphics = Graphics.FromImage(btmp))

{

graphics.FillRectangle(SystemBrushes.Control, new Rectangle(0, 0, 16, 16));

graphics.DrawRectangle(Pens.Black, 2, 4, 10, 8);

}

rectObj.ToolBarImage = btmp;

manager.Objects.Add(rectObj);

}

Regards

SSSKKK

 

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, February 12, 2009 1:44:31 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

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

If you mean that you want to create an Annotation rectangle object programmatically when clicking the button, you can do this by using the AnnRectangleObject Class as follows:
+--------+
AnnRectangleObject rect = new AnnRectangleObject();
rect.Pen = new AnnPen(Color.Red, new AnnLength(2, AnnUnit.Pixel));
rect.Brush = new AnnSolidBrush(Color.White);
rect.Bounds = new AnnRectangle(100, 200, 400, 600, AnnUnit.Pixel);
AnnAutomationObject.Container.Objects.Add(rect);
+--------+

If you mean something else, please provide me with more details about your requirements.

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#3 Posted : Thursday, February 12, 2009 2:19:25 AM(UTC)

ssskkk  
ssskkk

Groups: Registered
Posts: 74


error happened at the line,

AnnAutomationObject.Container.Objects.Add(rect);

Error is AnnAutomationObject does not contain a defenition for Container.

Regards

SSSKKK

 
#4 Posted : Thursday, February 12, 2009 2:29:09 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

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

What is the type of the AnnAutomationObject object that you use?
The type of the AnnAutomationObject object must be AnnAutomation class. You should use the AnnAutomation object that you define in your code.

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#5 Posted : Thursday, February 12, 2009 2:33:19 AM(UTC)

ssskkk  
ssskkk

Groups: Registered
Posts: 74


i cant understand
 
#6 Posted : Thursday, February 12, 2009 5:40:50 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

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

After creating the Annotation rectangle object, you need to add it to the Annotation Container (AnnContainer object). If you are using the LEADTOOLS Automation Annotation features (AnnAutomation class), the AnnAutomation object contains Annotation Container (AnnAutomation.Container).
For example, the following code shows how to create the AnnAutomation object and then create an Annotation rectangle object and add it to the Annotation Container:
+-----+
...
manager = new AnnAutomationManager();

// Create only the line and rectangle automation objects

CreateMyAutomationObjects(manager);

// You can instruct the manager to create the default (all) automation objects.

// comment out the call to CreateMyAutomationObjects and call this instead:

//theManager.CreateDefaultObjects();

// create the toolbar and add it to the form

manager.CreateToolBar();

Controls.Add(manager.ToolBar);

// set up the automation (will create the container as well)

AnnAutomation Myautomation = new AnnAutomation(manager, rasterImageViewer2 );

// set up this automation as the active one

Myautomation.Active = true;

//Create the Annotation Rectangle object

AnnRectangleObject rect = new AnnRectangleObject();
rect.Pen = new AnnPen(Color.Red, new AnnLength(2, AnnUnit.Pixel));
rect.Brush = new AnnSolidBrush(Color.White);
rect.Bounds = new AnnRectangle(100, 200, 400, 600, AnnUnit.Pixel);
Myautomation.Container.Objects.Add(rect);
...
+-----+

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#7 Posted : Thursday, February 12, 2009 7:20:55 PM(UTC)

ssskkk  
ssskkk

Groups: Registered
Posts: 74


Hello,

      The above code is working fine. The above code is  already sent  you(please check above). But I want to draw a rectangle when i click on the button name Rectangle. Not necessary to  display a Rectangle  toolbar. The above is code will be showing a rectangle toolbar and after cliking the rectanglr toolbar  ,then  we can draw the rectangle on the imageviewer.But i  need not to be show   rectangle toolbar, but i  want to draw a rectangle when i click the button name Rectangle directly.

Thanks

SSSKKK

 

 
#8 Posted : Friday, February 13, 2009 12:06:04 AM(UTC)

ssskkk  
ssskkk

Groups: Registered
Posts: 74


hello,

  It is working with fine using Annautomationobject .

With AnnautomationObject , i draw rectangle, ellispe,line,and Polygon.

But i can not  draw a rounded Rectangle and Polybezier using Annautomation object. Can  we draw rounded Rectangle and Polybezier  using AnnautomationObject

Thanks

SSSKKK

 
#9 Posted : Sunday, February 15, 2009 3:22:00 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

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

I am afraid that we don't have Annotation Automation Rounded rectangle or Polybezier objects.

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#10 Posted : Sunday, February 15, 2009 6:31:38 PM(UTC)

ssskkk  
ssskkk

Groups: Registered
Posts: 74


Hello,

       Can we have to implent(draw) Rounded Rectangle and Ploybezier using

leadttools 16 in any way.

Thanks

SSSKKK

 
#11 Posted : Sunday, February 15, 2009 11:12:13 PM(UTC)

ssskkk  
ssskkk

Groups: Registered
Posts: 74


Hello,

  My application windows application  using c#.net 2008 and .net framework is 3.5 and also use leadtools version 16. I drew a rectangle shape  on the rasterimageviewer using annotaion. If theDrewed  rectangle shape is not needed   , then if i press the DEL key , the rectangle shape is not disppeared. I want to delete(disppeared) rectangle shape , if  it not to be needded( when i press DEl Key).

Thanks

SSSKKK.

 
#12 Posted : Monday, February 16, 2009 12:12:05 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

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

You should be able to delete any annotation automation object by pressing the DEL key.

How exactly are you creating the Annotation Rectangle object?

Can you please provide me with a code snippet that shows how exactly are you creating the Annotation rectangle object an adding it to the RasterImageViewer control?

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#13 Posted : Monday, February 16, 2009 1:05:28 AM(UTC)

ssskkk  
ssskkk

Groups: Registered
Posts: 74


automationManager = new AnnAutomationManager();

automationManager.CreateDefaultObjects();

AnnAutomation automation = new AnnAutomation(automationManager, viewerImage );

automation.Container.UnitConverter.DpiX = viewerImage.Image.XResolution;

automation.Container.UnitConverter.DpiY = viewerImage.Image.YResolution;

AnnAutomationObject obj = new AnnAutomationObject();

switch (typeShape )

{

case shapeTypeNew.Line:

obj.Id = -2;

currentObjectId = obj.Id;

break;

case shapeTypeNew.Rectangle:

obj.Id =- 3;

currentObjectId = obj.Id;

break;

case shapeTypeNew.Ellipse:

obj.Id = -4;

currentObjectId = obj.Id;

break;

case shapeTypeNew.Polygon:

obj.Id = -6;

currentObjectId = obj.Id;

break;

}

automationManager.CurrentObjectId = currentObjectId;

 
#14 Posted : Monday, February 16, 2009 6:01:28 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

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

Your code doesn't show how exactly you are creating the Annotation Rectangle object.
If you create the Annotation Rectangle object programmatically by using the following code, do you face the same issue?
The code as follows:
+---------+
AnnRectangleObject rect = new AnnRectangleObject();
rect.Pen = new AnnPen(Color.Red, new AnnLength(2, AnnUnit.Pixel));
rect.Brush = new AnnSolidBrush(Color.White);
rect.Bounds = new AnnRectangle(100, 200, 400, 600, AnnUnit.Pixel);
AnnAutomationObject.Container.Objects.Add(rect);
+---------+

Also, if you try the same issue by using the LEADTOOLS C# Annotation Automation demo that ships with the LEADTOOLS SDK, do you face the same issue?

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
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-2024, Yet Another Forum.NET
This page was generated in 0.133 seconds.