VintaSoft Annotation .NET Plug-in Discussions
Questions, comments and suggestions concerning VintaSoft Annotation .NET Plug-in.
Board index < VintaSoft Imaging < VintaSoft Annotation .NET Plug-in Discussions
private void annotationViewer1_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
AnnotationView annotationView = null;
AnnotationData data = null;
data = new RectangleAnnotationData();
data.FillBrush = new AnnotationSolidBrush(Color.Green);
var xPlace = AnnotationViewer.Images[annotationViewer1.FocusedIndex].Resolution.Horizontal;
var yPlace = AnnotationViewer.Images[annotationViewer1.FocusedIndex].Resolution.Vertical;
var xPoint = 96 / xPlace;
var yPoint = 96 / yPlace;
var xPosition = Convert.ToDecimal(Convert.ToInt32(e.X) * xPoint);
var yPosition = Convert.ToDecimal(Convert.ToInt32(e.Y) * yPoint);
var wSize = Convert.ToDecimal(Convert.ToInt32(10) * xPoint);
var hSize = Convert.ToDecimal(Convert.ToInt32(10) * yPoint);
var xLocation = Convert.ToDecimal(xPosition + wSize / 2);
var yLocation = Convert.ToDecimal(yPosition + hSize / 2);
data.Location = new Point(Convert.ToInt32(xLocation), Convert.ToInt32(yLocation));
data.Size = new Size(Convert.ToInt32(wSize), Convert.ToInt32(hSize));
if (data != null)
{
// start the annotation building
AnnotationViewer.AddAndBuildAnnotation(data);
}
}
}