Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Drawing;
- using System.Data;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace SelectAlll
- {
- public partial class SelectAll: UserControl
- {
- public SelectAll()
- {
- InitializeComponent();
- }
- public List<string> Estados = new List<string>();
- private void SelectAll_Load(object sender, EventArgs e)
- {
- }
- public void Deschequear()
- {
- chk.Checked = false;
- }
- private void chk_CheckedChanged(object sender, EventArgs e)
- {
- foreach (Control r in this.ParentForm.Controls)
- {
- if (r is CheckBox)
- {
- if(((CheckBox)r).Checked == false )
- {
- Graphics g = this.ParentForm.CreateGraphics();
- int x = r.Location.X;
- int y = r.Location.Y;
- int ancho = r.Size.Height;
- int largo = r.Size.Width;
- g.DrawRectangle(Pens.Blue, x - 2, y - 2, largo + 2, ancho + 2);
- }
- if (chk.Checked == true)
- {
- Estados.Add(((CheckBox)r).Name.ToString() + ','+((CheckBox)r).Checked.ToString());
- ((CheckBox)r).Checked = true;
- }
- if (chk.Checked == false)
- {
- foreach (string s in Estados)
- {
- string[] chkestados = s.Split(',');
- if ( ((CheckBox)r).Name == chkestados[0])
- {
- ((CheckBox)r).Checked = bool.Parse(chkestados[1]);
- if (((CheckBox)r).Checked == false)
- {
- Graphics g = this.ParentForm.CreateGraphics();
- Pen p = new Pen(this.ParentForm.BackColor);
- int x = r.Location.X;
- int y = r.Location.Y;
- int ancho = r.Size.Height;
- int largo = r.Size.Width;
- g.DrawRectangle(p, x - 2, y - 2, largo + 2, ancho + 2);
- }
- }
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement