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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Selva GanapathyRank #560 · 4.3K reputationPosted Sep 29, 2014, 6:15 AM EDT
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
Enos128 reputationPosted Sep 30, 2014, 4:15 AM EDT
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
Enos128 reputationPosted Sep 30, 2014, 4:25 AM EDT
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)
{
}
Suzan Mat2 reputationPosted Oct 1, 2014, 5:33 AM EDT
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.