本文整理汇总了C#中System.Windows.Forms.Control.Count方法的典型用法代码示例。如果您正苦于以下问题:C# Control.Count方法的具体用法?C# Control.Count怎么用?C# Control.Count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Control
的用法示例。
在下文中一共展示了Control.Count方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckControlsNull
/// <summary>
/// 判定文本框或者combox下拉框是否为空
/// </summary>
/// <param name="c">容器组</param>
/// <returns>全部不空为真,其余为假</returns>
public bool CheckControlsNull(Control[] c)
{
bool allNotNull = true;
for (int i = 0; i < c.Count(); i++)
{
if (allNotNull == false) break;
foreach (Control cc in c[i].Controls)
{
if (cc is TextBox || cc is ComboBox)
{
if (cc.Text.Trim() == "")
{
allNotNull = false;
break;
}
}
}
}
return allNotNull;
}
示例2: ClearControlsText
/// <summary>
/// 清除文本框或者combox下拉框
/// </summary>
/// <param name="c">要清除里面容器的容器或者面板数组</param>
public void ClearControlsText(Control[] c)
{
for (int i = 0; i < c.Count();i++ )
{
foreach(Control cc in c[i].Controls)
{
if (cc is TextBox || cc is ComboBox)
{
if (cc.Text.Trim() != "") cc.Text = "";
}
//else
//{
// break;
//}
}
}
}
示例3: clearDisplay
/// <summary>
/// Clear thumbnails method
/// Disposes all panels and images created for thumbnails. Disables picture data panel and clears panel data.
/// </summary>
private void clearDisplay()
{
int controlCounter = 0;
int controlCount = panel1.Controls.Count - 1;
Control[] controlList = new Control[controlCount];
panel1.Hide();
foreach (Panel value in panel1.Controls) //get all panels, excluding border panel
{
if (value != panel_Border)
{
controlList[controlCounter] = value;
controlCounter++;
}
}
//dispoose all panels
for (int j = controlList.Count() - 1; j >= 0; j--)
{
if (controlList[j].Name != panel2.Name) //dispose of panels that is not the processing image panel
{
controlList[j].Dispose();
}
}
panel1.Show();
//Clear and disable data panel
panel_Border.Visible = false;
textBox_Name.Text = "";
richTextBox_Description.Text = "";
panel_PictureData.Enabled = false;
label_picSize.Text = "";
removeToolStripMenuItem.Enabled = false;
}