Exemplo n.º 1
0
        private void InnerDisable(Control.ControlCollection controls)
        {
            foreach (TextBox text in controls.OfType<TextBox>().ToList())
            {
                text.BackColor = SystemColors.Window;
                text.BorderStyle = BorderStyle.None;
                text.Location = new Point(text.Location.X, text.Location.Y + 5);
                text.ReadOnly = true;
            }

            foreach (RadioButton radio in controls.OfType<RadioButton>().ToList())
                if (!radio.Checked)
                    radio.Enabled = false;

            foreach (ComboBox combo in controls.OfType<ComboBox>().ToList())
                combo.Enabled = false;
        }
Exemplo n.º 2
0
        public bool controlisinedit( Control controls)
        {
            foreach (Control c in controls.OfType<TextBox>())
            {
                  if (c.Text != "")
                     return true;
            }

            //else
            return false;
        }
Exemplo n.º 3
0
 private static object FindControl(string name, Control.ControlCollection c)
 {
     Control control = c.Find(name, true).FirstOrDefault();
     if (control != null)
         return control;
     foreach (MenuStrip menu in c.OfType<MenuStrip>())
     {
         var item = menu.Items.Find(name, true).FirstOrDefault();
         if (item != null)
             return item;
     }
     foreach (ContextMenuStrip strip in FindContextMenuStrips(c.OfType<Control>()))
     {
         var item = strip.Items.Find(name, true).FirstOrDefault();
         if (item != null)
             return item;
     }
     return null;
 }
 private static void ClearBindingsRecursively(Control.ControlCollection collection)
 {
     if (collection == null)
         return;
     foreach (var item in collection.OfType<Control>())
     {
         ClearBindingsRecursively(item.Controls);
         item.ClearBindings(true, true);
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// コントロールバインドクリア
 /// </summary>
 /// <param name="controls">Formに配置したコントロール</param>
 protected void ClearBindings(Control.ControlCollection controls)
 {
     controls.OfType<Control>()
             .ToList()
             .ForEach(x => x.DataBindings.Clear());
 }
Exemplo n.º 6
0
        private void SetReadonlyControls(Control.ControlCollection controlCollection)
        {
            if (controlCollection == null)
            {
                return;
            }

            foreach (TextBoxBase c in controlCollection.OfType<TextBoxBase>())
            {
                c.ReadOnly = true;
            }
        }