I need to convert ListBox items into dynamic Buttons. Means, my tool has a ComboBox for showing text files in a folder which contain text links.
When items are selected in the ComboBox, the ListBox below is filled.
I want to remove the ComboBox and add Buttons instead.
How to add Buttons dynamically in a Panel, with variable Text
and Width
?
How to handle Click
events of the dynamically Buttons?
This is how the software is currently working:
I'm want to change the interface as shown in the image.
At the moment, my concern is the dynamic Buttons functionality and how to add them to a Panel.
I need help with that.
This is what I need to do:
Thank you guys! It's done as I expected. I used GunaFramework for corner round buttons. And I used below code for dynamic buttons.
for (int i = 0; i < 5; i++)
{
Button button = new Button();
button.Tag = i;
button.AutoSize = true;
button.Text = fNames[i].Split('\\').Last().Replace(".txt", "");
button.Click += (s, c) => { your action; };
FlowLayOutPanel.Controls.Add(button);
}