1
Greetings guys.
I have a "problem" and I wanted some ideas of how I can solve it.
My goal is to make a selection "animation" on several Buttons, so that when one of the Buttons is clicked, a Panel is created on it (and, in case another Button is already selected, it removes the Panel from it).
Let me be more specific. Suppose there is a list of buttons numbered 1 to 3, right? The first Button to be clicked will be Button 1, so a colored Panel will be created on it indicating the selection of the same. After that, Button 3 is clicked so that the Panel created on Button 1 is removed and a new one is created on Button 3.
That’s where my doubt lies. I have a dynamic class for the creation of the Panel on the selected Button, but, I do not know how to perform this "change of positions", made when another Button is selected.
Follows the content of the class:
public class an
{
public static void a(Button sender)
{
Panel p = new Panel();
p.BackColor = Color.FromArgb(32, 184, 251);
p.Dock = DockStyle.Right;
p.Name = "p";
p.Size = new Size(8, sender.Height);
sender.Controls.Add(p);
sender.BackColor = Color.FromArgb(40, 40, 40);
}
}
The code works well, follows a link with images.
Note that when clicking, the selection of the Button is made with the change of the background color and the creation of a Panel in blue color. Thus, I would like to adapt my code to the "counter-selection" (I believe this term does not exist, hahaha) of the other Buttons.
Therefore, I await answers!
I’m sorry if I wasn’t clear on something.