Ejemplo n.º 1
0
 private void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     PictureBox1.Image = Image.FromFile(@"..\..\foto\fotocap.jpg");
     try {
         for (int i = 0; i < lstPerson.Count; i++)
         {
             if ((lstPerson[i].surname + " " + lstPerson[i].name) == ListBox1.SelectedItem.ToString())
             {
                 TextBoxSurname.Text = lstPerson[i].surname;
                 TextBoxName.Text    = lstPerson[i].name;
                 MaskedTBPhone.Text  = lstPerson[i].phone;
                 TextBoxEmail.Text   = lstPerson[i].email;
                 LabelNumber.Text    = lstPerson[i].number.ToString();
                 if (lstPerson[i].picture != "")
                 {
                     PictureBox1.Image    = Image.FromFile(lstPerson[i].picture);
                     PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
                 }
                 ButtonAdd.Hide();
                 ButtonCLear.Hide();
                 ButtonSave.Show();
                 ButtonDell.Show();
                 ButtonCancel.Show();
                 break;
             }
         }
     }
     catch (NullReferenceException) { }
 }
Ejemplo n.º 2
0
        public Alerts(string LabelTitle, string LabelSubTitle, string LabelText, byte QuantityButtons = 3, string Button1 = "", string Button2 = "", string Button3 = "OK", TypeIcon Option = TypeIcon.Info)
        {
            InitializeComponent();
            ArrayButton             = new Button[] { ButtonYes, ButtonNo, ButtonCancel };
            this.QuantityButtons    = QuantityButtons;
            this.LabelTitle.Text    = LabelTitle;
            this.LabelSubTitle.Text = LabelSubTitle;
            this.LabelText.Text     = LabelText;
            ButtonYes.Text          = Button1.Trim();
            ButtonNo.Text           = Button2.Trim();
            ButtonCancel.Text       = Button3.Trim();
            switch (Option)
            {
            case TypeIcon.Info:
            default:
            {
                PictureBoxIcon.Image = Resources.InformationWhite;
                break;
            }

            case TypeIcon.Warning:
            {
                PictureBoxIcon.Image = Resources.WarningWhite;
                break;
            }

            case TypeIcon.Danger:
            {
                PictureBoxIcon.Image = Resources.BugWhite;
                break;
            }
            }
            switch (QuantityButtons)
            {
            case 1:
            {
                ButtonYes.Hide();
                ButtonNo.Hide();
                ButtonCancel.Show();
                ButtonCancel.DialogResult = DialogResult.OK;
                break;
            }

            case 2:
            {
                ButtonYes.Hide();
                ButtonNo.Show();
                ButtonNo.DialogResult = DialogResult.Yes;
                ButtonCancel.Show();
                ButtonCancel.DialogResult = DialogResult.No;
                break;
            }

            case 3:
            default:
            {
                ButtonYes.Show();
                ButtonYes.DialogResult = DialogResult.Yes;
                ButtonNo.Show();
                ButtonNo.DialogResult = DialogResult.No;
                ButtonCancel.Show();
                ButtonCancel.DialogResult = DialogResult.Cancel;
            }
            break;
            }
        } //Clave de Método: Alerts-C