1
有没有在C#东西像在CSS - "float: left | right | none | inherit"
?
我想显示在我的表格 - TextBox
及以下各TextBox
- PictureBox
。所以,我不知道每个TextBox
的大小,也可以是不同的,在我的结果覆盖PictureBoxes
.... TextBoxes
如何在表单中放置动态项目?
static int k = 1;
for (int att = 0; att < feed.response.items[i].attachments.Count(); att++)
{
string switchCase = feed.response.items[i].attachments[att].type;
switch (switchCase)
{
case "photo":
TextBox text = new TextBox();
text.Text =Encoding.UTF8.GetString(Encoding.Default.GetBytes(feed.response.items[i].text));
Point p = new Point(20, 30 * k);
text.Location = p;
this.Controls.Add(text);
PictureBox mypic = new PictureBox();
mypic.ImageLocation = feed.response.items[i].attachments[att].photo.photo_130;
mypic.Size = new Size(100, 100);
Point g = new Point(40, 160 * k);
mypic.Location = g;
this.Controls.Add(mypic);
k++;
break;
....
}
}
尝试使用谷歌中搜索如何将控件添加动态的形式的WinForms C# – MethodMan
我会用一个网格布局对于这种的东西 – Gino
你可能希望['TableLayoutPanel'](https://msdn.microsoft.com/en-us/library/system.windows.forms.tablelayoutpanel(v = vs.110).aspx)与'ColumnCount'属性设置为“1”。如果没有[可靠,_minimal_,_complete_代码示例](http://stackoverflow.com/help/mcve)可以可靠地说明您的场景,那么很难肯定地说,不必介意以代码示例提供有用的答案。 –