Click here to Skip to main content
15,891,316 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I use VS2012/C# on Win7 to test Panel control:


Image img = Image.FromFile(Application.StartupPath + @"\1.png");

 panel1.AutoScroll = true;
 panel1.Height = 500;

 for (int i = 0; i < 50; i++)
 {
     PictureBox pb = new PictureBox();
     pb.Left = i*10;
     pb.Top = i * (img.Height + 10);
     pb.SizeMode = PictureBoxSizeMode.AutoSize;
     pb.Image = img;
     toolTip1.SetToolTip(pb, i.ToString()+":  "+pb.Top.ToString());
     panel1.Controls.Add(pb);
 }


Some PictureBox control is added into panel1. If the 'Top' of a picture box is less than 32767, the picture box can be placed in right position. But if the 'Top' of a picture box is greater than 32767, the picture box can not be placed in right position, it will be placed at the bottom of the panel. In an another word, the maximum scrollable height of Panel control is like 32767.

This issue is exist on Win7/8, and no this issue found in WinXP. It is no relation with VS versions and .NET framework versions, just in relation with Windows versions.

I want all picture box in wanted position in panel. Is any method?
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900