As far as i know, when controls are added to
FlowLayoutPanel
, they are "sorted" in the order of addition.
I'd suggest to use
List<T>[
^] generic class to manage controls. It contains several properties and methods which enables you to sort elements, add, check if exists, clear, etc.
Implementation:
1) Before you add control to
FlowLayoutPanel
,
a) check if it exists in the collection,
b) if not exists - add it to
List<T>
c) sort elements
2) Remove controls from FlowLayoutPanel
3) Add controls to FlowLayoutPanel from
List<T>
Maybe it's not elegant solution, but at this moment i have no better idea.