Ssasidhar
Ssasidhar

Reputation: 485

Dynamic Controls and their position in panel in window forms? C#.Net?

In window forms, i created a panel dynamically, in that i want to place labels which are dynamically created, now i want to place the lables in a neat format, i mean alignment,line by line. Every time i am creating the label and binding the label to panel until the data is there in data set. so i want proper arrange for that label, is there any reference, could be very appreciate, thank you.

Upvotes: 0

Views: 3268

Answers (1)

user1693593
user1693593

Reputation:

You could try to use the FlowLayoutPanel instead of the ordinary Panel.

Set it to order in the direction you want, optionally turn of wrapping, and you would have the content organized automatically.

Optionally you would need to traverse your panel's labels and set (pseudo, vertical direction):

currentLabel.Top = prevLabel.Top + prevLabel.height + mySpacing

Upvotes: 1

Related Questions