I want to press on the left mouse button and then i want to draw a line.
when i put my finger of the left mouse button then the line must stop ?
how can i do that
Drawing a line
Moderator: Alex
-
- Posts: 64
- Joined: Wed Jul 23, 2008 2:47 pm
Re: Drawing a line
It's possible to draw Line annotation as following in Annotation Demo example:
- You choose line annotation
-Click and hold left mouse button on necessary position in an image, then pull the mouse: drawing starts
- Release left mouse button: drawing stops
You can also use Lines annotation (next one after Line annotation).
Here is possible the following:
- You choose lines annotation
-Click left mouse button on necessary position in an image, then pull the mouse: drawing starts
- Double click left mouse button: drawing stops
- You choose line annotation
-Click and hold left mouse button on necessary position in an image, then pull the mouse: drawing starts
- Release left mouse button: drawing stops
You can also use Lines annotation (next one after Line annotation).
Here is possible the following:
- You choose lines annotation
-Click left mouse button on necessary position in an image, then pull the mouse: drawing starts
- Double click left mouse button: drawing stops
-
- Posts: 6
- Joined: Mon Dec 21, 2009 1:43 pm
Re: Drawing a line
When i draw a line in your demo, the line starts with the left mouse button and stops with the right mouse button.
i want to start drawing a line with the left mouse button and hold my finger on the left mouse button till i want to stop the line.
how do i do that ?
i want to start drawing a line with the left mouse button and hold my finger on the left mouse button till i want to stop the line.
how do i do that ?
-
- Posts: 64
- Joined: Wed Jul 23, 2008 2:47 pm
Re: Drawing a line
You should create custom annotation based on standard one (please read the library documentation "Getting Started - Create a custom annotation").
Please try one of the variants of c# code below, both allow start and finish drawing with left mouse click:
Please try one of the variants of c# code below, both allow start and finish drawing with left mouse click:
Code: Select all
//based on LinesAnnotation
class MyLineAnnotation : LinesAnnotation
{
protected override void OnBuilding(MouseEventArgs mouse, MouseActions action)
{
if (action == MouseActions.Click && Points.Count == 3)
FinishBuilding(mouse.Location);
else
base.OnBuilding(mouse, action);
}
}
Code: Select all
//based on LineAnnotation
class MyLineAnnotation2 : LineAnnotation
{
bool _skipFirstUp;
protected override void OnStartBuilding(PointF point)
{
_skipFirstUp = false;
base.OnStartBuilding(point);
}
protected override void OnBuilding(MouseEventArgs mouse, MouseActions action)
{
if (action == MouseActions.Up && !_skipFirstUp)
{
//Skip first Mouse Up action
_skipFirstUp = true;
return;
}
base.OnBuilding(mouse, action);
}
}