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 : Monday, February 9, 2009 1:43:43 AM(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, i drag and drop an rasterimageviewer in the form.It is for display in the image.No w i want to draw a shape on the image like polygon,rounded rectangle and polybezier etc.

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 : Monday, February 9, 2009 5:11:38 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 draw shapes on the raster image, you need to create a graphic object from the image, and use this graphic object to draw the rectangle, line, etc. Please check the following code:
+----------+
System.Drawing.Graphics G = MyRasterImageCreateGdiPlusGraphics().Graphics;
G.DrawLine(...)
+----------+

But if you mean that you want to give the user the ability to draw these shapes on the image, you can use the LEADTOOLS Annotaion objects. For more information, please see the following page:
http://www.leadtools.com/SDK/Document/Document-Annotation.htm

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#3 Posted : Monday, February 9, 2009 7:56:32 PM(UTC)

ssskkk  
ssskkk

Groups: Registered
Posts: 74


Please give me the full code
 
#4 Posted : Tuesday, February 10, 2009 12:11:58 AM(UTC)

ssskkk  
ssskkk

Groups: Registered
Posts: 74


hello,

     I want to draw the shape as,

1)Rounded Rectangle.

2)Polygon

3)Polybezier

 
#5 Posted : Tuesday, February 10, 2009 12:56:05 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

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

Do you want to draw the shapes using the System.Drawing.Graphics class? Or you want to use LEADTOOLS Annotation features?

For more information about the LEADTOOLS Annotation features, please see the following page:
http://www.leadtools.com/SDK/Document/Document-Annotation.htm

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#6 Posted : Tuesday, February 10, 2009 2:17:33 AM(UTC)

ssskkk  
ssskkk

Groups: Registered
Posts: 74


system.drawing.graphic class needed.
 
#7 Posted : Tuesday, February 10, 2009 4:05:51 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

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

The code will be something as follows:
+-------------+
 
public void TestDraw()
{
Graphics objG = MyRasterImage.CreateGdiPlusGraphics().Graphics;
Pen objP = new Pen(Color.Blue);

//Draw Rounded Rectangle
RoundRectangle(objG, objP, 100, 200, 200, 100, 10);

// Draw Polygon
objG.DrawPolygon(...);

// Draw Bezier
objG.DrawBezier(...);

}

public void RoundRectangle(Graphics objG, Pen objP, float h, float v,
float width, float height, float radius)
{
GraphicsPath objGP = new GraphicsPath();
objGP.AddLine(h + radius, v, h + width - (radius * 2), v);
objGP.AddArc(h + width - (radius * 2), v, radius * 2, radius * 2, 270, 90);
objGP.AddLine(h + width, v + radius, h + width, v + height - (radius * 2));
objGP.AddArc(h + width - (radius * 2), v + height - (radius * 2), radius * 2, radius * 2, 0, 90); // Corner
objGP.AddLine(h + width - (radius * 2), v + height, h + radius, v + height);
objGP.AddArc(h, v + height - (radius * 2), radius * 2, radius * 2, 90, 90);
objGP.AddLine(h, v + height - (radius * 2), h, v + radius);
objGP.AddArc(h, v, radius * 2, radius * 2, 180, 90);
objGP.CloseFigure();
objG.DrawPath(objP, objGP);
objGP.Dispose();
}
+-------------+

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#8 Posted : Wednesday, February 11, 2009 10:57:59 PM(UTC)

ssskkk  
ssskkk

Groups: Registered
Posts: 74


sorry,

I want the leadtools features

soorry Once again

 
#9 Posted : Thursday, February 12, 2009 12:46:39 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 Annotation rectangle object programmatically, 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);
ActiveAnnotationsForm.Automation.Container.Objects.Add(rect);
+--------+

You can create Annotation curves by using the AnnPolygonObject, AnnCurveObject, AnnPolylineObject and AnnClosedCurveObject Classes.

For more information, please refer to the LEADTOOLS .Net documentation.

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#10 Posted : Thursday, February 12, 2009 1:07:28 AM(UTC)

ssskkk  
ssskkk

Groups: Registered
Posts: 74


hello,

Error happened at,

Automation.Container.Objects.Add(rect);

error is:Automation does not contain a defenition for Container.

regards

ssskkk

 
#11 Posted : Thursday, February 12, 2009 2:27:06 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 Automation object that you use?
The type of the Automation object must be AnnAutomation class. You should use the AnnAutomation object that you define in your code.

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

ssskkk  
ssskkk

Groups: Registered
Posts: 74


i cant understand , please give me more explanations

regards

ssskkk

 
#13 Posted : Thursday, February 12, 2009 5:39:10 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
 
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.108 seconds.