private void pruebasquerys_Load(object sender, EventArgs e) { this.cbs = new printCbar(); this.cbs.setParams(100); this.cbs.print(); }
protected virtual void setAtribs() { this.controls = new List <Control>() { this.txt1, this.txt3, this.cb1, this.txtcosto, this.cbganancia, this.txt2, this.txt4 }; this.tboxes = new List <TextBox>() { this.txt1, this.txt2, this.txt3, this.txt4, this.txtcosto }; behaviorDefinitions.txtOnlyNumbers(ref this.txt3); behaviorDefinitions.txtOnlyNumbers(ref this.txt4); behaviorDefinitions.txtPrice(this.txtcosto); behaviorDefinitions.txtPrice(this.txt2); controls.ElementAt(0).KeyPress += (x, y) => { if (y.KeyChar == (char)Keys.Enter) { controls.ElementAt(1).Focus(); } }; controls.ElementAt(1).KeyPress += (x, y) => { if (y.KeyChar == (char)Keys.Enter) { controls.ElementAt(2).Focus(); } }; controls.ElementAt(2).KeyPress += (x, y) => { if (y.KeyChar == (char)Keys.Enter) { controls.ElementAt(3).Focus(); } }; controls.ElementAt(3).KeyPress += (x, y) => { if (y.KeyChar == (char)Keys.Enter) { controls.ElementAt(4).Focus(); } }; controls.ElementAt(4).KeyPress += (x, y) => { if (y.KeyChar == (char)Keys.Enter) { controls.ElementAt(5).Focus(); } }; controls.ElementAt(5).KeyPress += (x, y) => { if (y.KeyChar == (char)Keys.Enter) { controls.ElementAt(6).Focus(); } }; this.txt4.KeyUp += (x, y) => { if (this.txt4.Text.Trim() != "") { this.picbox.Image = this.cbar.getImage(this.txt4.Text.Trim()); } }; this.txt4.KeyPress += (x, y) => { if (y.KeyChar == (char)Keys.Enter && (this.txt4.Text.Trim() != "")) { this.onAccept(); } }; this.txt4.KeyUp += (x, y) => { if (this.txt4.Text.Trim() == "") { this.generateCBAR(); } }; this.baccept.Click += (x, y) => { this.onAccept(); }; this.bcancel.Click += (x, y) => { this.onCancel(); }; this.prod = new producto(); for (int x = 0; x < 101; ++x) { this.cbganancia.Items.Add(x.ToString() + "%"); } this.cbganancia.SelectedIndex = 0; this.cbganancia.SelectedIndexChanged += (sender, args) => { if (this.txtcosto.Text.Trim() != string.Empty) { Double val = Double.Parse(this.txtcosto.Text, CultureInfo.InvariantCulture); this.txt2.Text = (val + ((val / 100) * this.cbganancia.SelectedIndex)).ToString("F2"); } }; this.cbprint = new printCbar(); }