从加载到流布局面板的控件中检索数据
Retrieve data from controls loaded into a flowlayoutpanel
首先是应用程序设置的图片:
每次用户点击 "Add Character" 时都会出现另一个字符框,它们是自定义控件。
我不知道该怎么做,就是在我点击保存按钮时从所有字符框中收集所有输入。
使用 FlowLayoutPanel
的 Controls
属性 将帮助您实现这一目标。
编辑:因为你的结构是 CharacterControl
在 FlowLayoutPanel
里面,其他所有东西都在 CharacterControl
里面,你可以这样做
foreach (CharacterControl charControl in flow1.Controls) {
//do something with control
//cast Control to the correct control type by using its Name property whenever necessary
//collect all the Text/value in the control here!, save it afterwards!
}
首先是应用程序设置的图片:
每次用户点击 "Add Character" 时都会出现另一个字符框,它们是自定义控件。
我不知道该怎么做,就是在我点击保存按钮时从所有字符框中收集所有输入。
使用 FlowLayoutPanel
的 Controls
属性 将帮助您实现这一目标。
编辑:因为你的结构是 CharacterControl
在 FlowLayoutPanel
里面,其他所有东西都在 CharacterControl
里面,你可以这样做
foreach (CharacterControl charControl in flow1.Controls) {
//do something with control
//cast Control to the correct control type by using its Name property whenever necessary
//collect all the Text/value in the control here!, save it afterwards!
}