tags:

views:

24

answers:

1

So ... for example I've got some template - panel with edits and data from an object And now I've got dynamic count of objects and I need dynamic count of panels somewhere :-/

I'm interested in any ideas if there any way to make this frame on WinForms.

+1  A: 

First, turn your "template" into a custom control, for the sake of simplicity, I'm going to refer to it as a MyControl that has a MyData property.

Now, let's say you need your horizontally scrolling Panel, with a MyControl per MyData, you could do:

IEnumerable<MyData> = GetMyData();
foreach( MyData thisData in GetMyData() )
{
    MyControl thisControl = new MyControl();
    thisControl.Dock = Left; // Or right, if you prefer
    thisControl.Value = thisData;
    panel1.Controls.Add( thisControl ); // Where panel1 is a Panel that represents the container for the scrolling-ness
}

Obviously, you'll want to tweak that to fit your types, maybe set a few other properties as appropriate.

Rowland Shaw
hm... Yes I want something like that. thank you
nCdy