本文整理汇总了C#中ControlCollection.Add方法的典型用法代码示例。如果您正苦于以下问题:C# ControlCollection.Add方法的具体用法?C# ControlCollection.Add怎么用?C# ControlCollection.Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ControlCollection
的用法示例。
在下文中一共展示了ControlCollection.Add方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateRepeatControl
public static void GenerateRepeatControl(ControlCollection controls, string SystemInfo)
{
if (!string.IsNullOrEmpty(SystemInfo)) {
SystemInfo = SystemInfo.Replace("PP", "P");
string[] RepeatFormStr = SystemInfo.Split('P');
if (RepeatFormStr.Length > 0) {
controls.Clear();
foreach (String formStr in RepeatFormStr) {
if (!string.IsNullOrEmpty(formStr)) {
if (controls.Count != 0) {
controls.Add(new LiteralControl(" , "));
}
controls.Add(CommonUtility.GetPostbackURLForRepeatForm(formStr));
}
}
}
}
}
示例2: Find
/// <summary>
/// Find all controls with the given name in a collection
/// </summary>
/// <param name="name"></param>
/// <param name="collection"></param>
/// <returns></returns>
private ControlCollection Find(string name, Control.ControlCollection collection)
{
ControlCollection results = new ControlCollection();
foreach (Control c in collection)
{
results.Add(Find(name, c));
// If the control is a ToolStripContainer we need to search in it's
// panels for controls matching the name we serching for.
if (c is ToolStripContainer)
{
ToolStripContainer container = (ToolStripContainer)c;
results.Add(Find(name, container.TopToolStripPanel.Controls));
results.Add(Find(name, container.LeftToolStripPanel.Controls));
results.Add(Find(name, container.RightToolStripPanel.Controls));
results.Add(Find(name, container.BottomToolStripPanel.Controls));
results.Add(Find(name, container.ContentPanel.Controls));
}
}
return results;
}
示例3: FindControls
private ControlCollection FindControls()
{
ControlCollection found = new ControlCollection();
foreach (Form form in FormCollection)
{
found.Add(Find(name, form));
}
return found;
}