private void btn2_Click(object sender, EventArgs e) { string seleccionado = ""; string [] todoText = txb1.Lines; int i = 0; int indice = -1; seleccionado = this.txb1.SelectedText; foreach (string item in todoText) { if (item == seleccionado && item != "-1") { indice = i; break; } i++; } seleccionado += " " + indice.ToString(); MessageBox.Show(seleccionado); FrmTempera frmtemp = new FrmTempera(_miPaleta[indice]); //utilizo la propiedad del INDEXADOR DialogResult rta = frmtemp.ShowDialog(); if (rta == DialogResult.OK) { this._miPaleta -= frmtemp.MiTempera; this.txb1.Text = (string)_miPaleta; } }
public Form1() { InitializeComponent(); this._miPaleta = 5; this.gb1.Text = "Paleta de Colores"; this.txb1.Multiline = true; //permite abritlo mas paraque sea un cuadrado this.btn1.Text = "+"; this.btn2.Text = "-"; }
private void btn1_Click(object sender, EventArgs e) { FrmTempera temp = new FrmTempera(); DialogResult rta = temp.ShowDialog(); if (rta == DialogResult.OK) { this._miPaleta += temp.MiTempera; this.txb1.Text = (string)_miPaleta; } }