k787
k787

Reputation: 427

C# positioning the controls after re-sizing the form

I'm working on a small movie database program using C#. I have bunch of dynamically added PictureBox objects located on top of a Panel container. I control their location by changing their X, Y values. By default I have 3 picturebox objects in one row. The problem is, when I resize the form, the positions of the images stay the same, however the behavior I'm looking for is, storing more PictureBox controls in each row.

Think each star as an image.

9 PictureBox;

    * * *
    * * *
    * * *

What I want is, based on the form size, store more images in one row. So it becomes this;

    * * * *
    * * * *
    *

Is there any other container other than panel has such feature?

Google images has a similar behavior. Thanks

Upvotes: 0

Views: 118

Answers (2)

Berial
Berial

Reputation: 557

Take a look at FlowLayoutPanel. http://msdn.microsoft.com/en-us/library/system.windows.forms.flowlayoutpanel.aspx

Upvotes: 0

Rosmarine Popcorn
Rosmarine Popcorn

Reputation: 10967

Use ImageList and place them in ListView ,ListView will automatically order them ,otherwise play with PictureBox.Anchor .

PS: ComponentOne has a Control named Sizer .ComponentOne

Upvotes: 1

Related Questions