コード例 #1
0
 /// <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
0
 /// <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
0
        /// <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;
        }