public static Tempera operator +(Tempera t1, double n) { Tempera t3 = new Tempera(t1._color, t1._marca, t1._cantidad); t3._cantidad = t1._cantidad + (int)n; return(t3); }
static void Main(string[] args) { Tempera temp = new Tempera(ConsoleColor.Cyan, "Colorin", 20); Tempera temp1 = new Tempera(ConsoleColor.Cyan, "Colorin", 10); Tempera temp2 = new Tempera(ConsoleColor.Black, "ColorOtro", 10); Paleta p = 5; p += temp; p += temp1; p += temp2; Console.Write((string)p); for (int i = 0; i < p.cantidadMaxColores; i++) { if (!Object.Equals(p[i], null)) { p[i].marca = ""; } p[i] = new Tempera(ConsoleColor.DarkMagenta, "ColorOtro", 10); Console.Write(p[i]); } Console.ReadKey(); }
//SOBRECARAGA RECIBE TEMPERA public FrmTempera(Tempera temp) : this() { _mitempera = temp; this.cbxColor.SelectedItem = temp.GetColor; this.tbxCantidad.Text = "" + (sbyte)temp; this.tbxMarca.Text = temp.GetMarca; }
private void button2_Click(object sender, EventArgs e) { this.DialogResult = DialogResult.Cancel; if (this.textBox2.Text != "" && this.textBox3.Text != "" && this.comboBox1.Text != "") { this._miTempera = new Tempera(sbyte.Parse(textBox3.Text), (ConsoleColor)this.comboBox1.SelectedItem, this.textBox2.Text); this.DialogResult = DialogResult.OK; } this.Close(); }
public static Tempera operator +(Tempera t1, Tempera t2) { Tempera t3 = new Tempera(t1._color, t1._marca, t1._cantidad); if (t1 == t2) { t3._cantidad = t1._cantidad + t2._cantidad; return(t3); } return(t1); }
public FrmTempera(Tempera tempera) : this() { this._miTempera = tempera; }
public static string Mostrar(Tempera a) { return(a.Mostrar()); }
private void btnAceptar_Click(object sender, EventArgs e) { //esto permite guardar los datos que le pasamos dentro de la variable _mitempera _mitempera = new Tempera(sbyte.Parse(this.tbxCantidad.Text), (ConsoleColor)this.cbxColor.SelectedItem, this.tbxMarca.Text); this.DialogResult = DialogResult.OK; }
private void button2_Click(object sender, EventArgs e) { this._miTempera = new Tempera(sbyte.Parse(textBox3.Text), (ConsoleColor)this.comboBox1.SelectedItem, textBox2.Text); this.Close(); }