本文整理汇总了C#中ControlCollection类的典型用法代码示例。如果您正苦于以下问题:C# ControlCollection类的具体用法?C# ControlCollection怎么用?C# ControlCollection使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ControlCollection类属于命名空间,在下文中一共展示了ControlCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Control
public Control()
{
if (formSkin == null)
formSkin = SharedInformation.ContentManager.Load<Texture2D>(@"data\fb\texture\wndskin.png");
if (gulim8 == null)
gulim8 = SharedInformation.ContentManager.Load<SpriteFont>(@"fb\Gulim8.xnb");
if (gulim8B == null)
gulim8B = SharedInformation.ContentManager.Load<SpriteFont>(@"fb\Gulim8b.xnb");
if (tingSound == null)
tingSound = SharedInformation.ContentManager.Load<SoundEffect>(@"data\wav\버튼소리.wav");
_controls = new ControlCollection(this);
_handle = GuiManager.Singleton.GetNewHandle();
_foreColor = Color.Black;
_backColor = Color.White;
_text = "";
_visible = true;
_enabled = true;
_tabStop = false;
_zorder = 0;
_font = Gulim8;
}
示例2: LoadProperties
protected void LoadProperties(string source)
{
XmlDocument document = new XmlDocument();
document.LoadXml(source);
XmlNodeList elementsByTagName = document.GetElementsByTagName("Property");
this.mPropertyDoc = (XmlDocument) document.Clone();
XmlElement element = this.mPropertyDoc.CreateElement("properties");
string str = "";
XmlNode newChild = null;
foreach (XmlNode node2 in elementsByTagName)
{
XmlAttribute namedItem = (XmlAttribute) node2.Attributes.GetNamedItem("control");
if (str != namedItem.Value)
{
newChild = element.OwnerDocument.CreateElement(namedItem.Value);
element.AppendChild(newChild);
str = namedItem.Value;
}
XmlElement element2 = newChild.OwnerDocument.CreateElement("Property");
for (int i = 0; i < node2.Attributes.Count; i++)
{
element2.SetAttribute(node2.Attributes[i].Name, node2.Attributes[i].Value);
}
newChild.AppendChild(element2);
}
this.Controls = new ControlCollection(element.ChildNodes);
}
示例3: RecurseControls
private void RecurseControls(ControlCollection c)
{
// Only one of the passed controls will contain all the questions.
int i = 0;
foreach (Control con in c)
{
HtmlGenericControl hgc = con as HtmlGenericControl;
if (hgc != null && hgc.TagName.ToUpperInvariant() == "H3")
{
if (hgc.Attributes["class"] == "question")
{
string id = "q" + i.ToString();
hgc.Attributes.Add("id", id);
// Add to TOC
HtmlGenericControl tocItem = new HtmlGenericControl("li");
HtmlGenericControl anchor = new HtmlGenericControl("a");
anchor.Attributes.Add("href", "#" + id);
anchor.InnerText = hgc.InnerText;
tocItem.Controls.Add(anchor);
toc.Controls.Add(tocItem);
i++;
}
}
this.RecurseControls(con.Controls);
}
}
示例4: DisplayData
protected void DisplayData(ControlCollection controls)
{
foreach (KeyValuePair<string, string> item in (Dictionary<string,string>)ViewState["formData"])
{
Label1.Text += item.Value + " ";
}
}
示例5: Add
/// <summary>
/// Add one ControlCollection to another. Combines them into one collection.
/// </summary>
/// <param name="collection">The collection to merge with this one.</param>
public void Add(ControlCollection collection)
{
foreach(Control control in collection)
{
Add(control);
}
}
示例6: ClearInputs
//this method clears all the textboxes without actually calling all the seperate values
private void ClearInputs(ControlCollection ctrls)
{
foreach (Control ctrl in ctrls)
{
if (ctrl is TextBox)
((TextBox)ctrl).Text = string.Empty;
ClearInputs(ctrl.Controls);
}
}
示例7: SetReadOnly
private void SetReadOnly(bool isReadOnly, ControlCollection collection)
{
foreach (DictionaryEntry dic in DataControlCollection)
{
IWebDataControl dc = (IWebDataControl)dic.Value;
dc.SetReadOnly(isReadOnly);
}
TxtVersion.SetReadOnly(true);
}
示例8: ClearControls
public void ClearControls(ControlCollection ctrl)
{
foreach(Control ctl in ctrl)
{
if(ctl is TextBox)
{
(ctl as TextBox).Text = " ";
}
ClearControls(ctl.Controls);
}
}
示例9: CompositeControlBase
protected CompositeControlBase()
{
_controls = new ControlCollection(this);
_controls.ControlAdded += (sender, args) => ChangeControl(args.Control, true);
_controls.ControlRemoved += (sender, args) => ChangeControl(args.Control, false);
_controls.ControlsReset += (sender, args) =>
{
args.OldControls.ForEach(c => ChangeControl(c, false));
args.NewControls.ForEach(c => ChangeControl(c, true));
};
}
示例10: Control
/// <summary>
/// Initializes a new instance of the <see cref="Control"/> class.
/// </summary>
protected Control()
{
this.Name = this.DefaultName;
if (this.CanContainAttributes)
{
this.attributes = new ControlAttributeCollection();
}
if (this.CanContainControls)
{
this.controls = new ControlCollection();
}
}
示例11: ClearInputs
private void ClearInputs(ControlCollection ctrls)
{
foreach (Control ctrl in ctrls)
{
if (ctrl is TextBox)
((TextBox)ctrl).Text = string.Empty;
else if (ctrl is DropDownList)
((DropDownList)ctrl).ClearSelection();
ClearInputs(ctrl.Controls);
}
}
示例12: AttachVisibilityBindings
public void AttachVisibilityBindings(ControlCollection controls)
{
for (int i = 0; (i < controls.Count); i = (i + 1))
{
if ((controls[i].DataBindings["Visible"] != null))
{
// Attach event handlers to auto-hide controls.
controls[i].DataBindings["Visible"].Format += new System.Windows.Forms.ConvertEventHandler(this.Visibility_Format);
controls[i].DataBindings["Visible"].DataSourceUpdateMode = System.Windows.Forms.DataSourceUpdateMode.Never;
}
}
}
示例13: SetControlPermission
private void SetControlPermission(ControlCollection controlCollection)
{
//new TextBox().Attributes[]
foreach (Control chilControl in controlCollection)
{
if ((chilControl as WebControl) != null)
(chilControl as WebControl).Attributes["permissionRequired"] = "Service";
if (chilControl.HasControls())
SetControlPermission(chilControl.Controls);
}
}
示例14: ClearTextboxes
public static void ClearTextboxes(ControlCollection cc)
{
foreach (Control ctrl in cc)
{
TextBox tb = ctrl as TextBox;
if (tb != null)
{
tb.Text = "";
}
else
ClearTextboxes(ctrl.Controls);
}
}
示例15: ClearControlsData
//if clear the values in form controls
private void ClearControlsData(ControlCollection ctrl)
{
foreach (Control ctr in ctrl)
{
if (ctr is TextBox)
(ctr as TextBox).Text = " ";
if (ctr is DropDownList)
(ctr as DropDownList).SelectedIndex = 0;
ClearControlsData(ctr.Controls);
}
}