Hi everyone,
I have 5 Ellipse circles and i want the user to select one at a time, the user must not select more than 1. how do i archive this..
Thanks.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Suzan MatPosted Oct 1, 2014, 9:33 AM
I am currently using this toolkit to create and annotate my documents. Annotation objects include different types of shapes (Rectangle, Ellipse, FreeHand, etc.) that trigger events when applying any action (click, draw, edit, etc.) on the annotation object.
You can handle the click event of the object to change the object's color, and then disable the object so that it's no longer clickable.
Note that annotations are usually drawn on a different layer over the image's pixel data. You can find more information here.
EnosPosted Sep 30, 2014, 8:25 AM
private void Right1_Click(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
}
private void Right2_Click(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
}
private void Right3_Click(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
}
private void Right4_Click(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
}
private void Right5_Click(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
}
EnosPosted Sep 30, 2014, 8:15 AM
Actually its a hand with with five fingers. on top of each finger i have put Ellipse. so i want the user to click one finger at a time. after that it must change color and it must not be selected again. how do i archive this
Selva GanapathyPosted Sep 29, 2014, 10:15 AM
Hi Enos,
This following code may help you in a better way.
public Form1()
{
InitializeComponent();
}
string ellipseNumber = "0";
private void button1_Click(object sender, EventArgs e)
{
ellipseNumber = (sender as Button).Text;
this.Invalidate();
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
e.Graphics.DrawEllipse(Pens.Orange, new Rectangle(100,100,100,100));
e.Graphics.DrawEllipse(Pens.Orange, new Rectangle(250, 100, 100, 100));
e.Graphics.DrawEllipse(Pens.Orange, new Rectangle(400, 100, 100, 100));
e.Graphics.DrawEllipse(Pens.Orange, new Rectangle(550, 100, 100, 100));
e.Graphics.DrawEllipse(Pens.Orange, new Rectangle(700, 100, 100, 100));
if(ellipseNumber == "1")
e.Graphics.FillEllipse(Brushes.Orange, new Rectangle(100, 100, 100, 100));
else if (ellipseNumber == "2")
e.Graphics.FillEllipse(Brushes.Orange, new Rectangle(250, 100, 100, 100));
else if (ellipseNumber == "3")
e.Graphics.FillEllipse(Brushes.Orange, new Rectangle(400, 100, 100, 100));
else if (ellipseNumber == "4")
e.Graphics.FillEllipse(Brushes.Orange, new Rectangle(550, 100, 100, 100));
else if (ellipseNumber == "5")
e.Graphics.FillEllipse(Brushes.Orange, new Rectangle(700, 100, 100, 100));
}
Regards,
Selva Ganapathy K