Пример #1
0
        //将下拉框选中的值,埴到exit中
        private void containerselect1_SelectedIndexChanged(object sender, EventArgs e)
        {
            try {
                containerselect   select   = (containerselect)sender;
                containermoneyall moneyall = (containermoneyall)(select.Parent);
                containeredit     edit     = null;
                foreach (Control trol in moneyall.Controls)
                {
                    if (trol.Name == "containeredit2")
                    {
                        edit = (containeredit)trol;
                        //((containeredit)trol).Text = select.Text.ToString();
                    }
                }

                if (select.Text != null)
                {
                    edit.Text = select.Text.ToString();
                }
                if (select.SelectedValue != null)
                {
                    edit.Tag = select.SelectedValue.ToString();
                    //edit.Text = edit.Text.Trim() + "  ID=" + edit.Tag.ToString();
                }
            }
            catch (Exception ex)
            {
                ex.errormess();
            }
        }
Пример #2
0
        public void set_TAG_x(int wz, string set_value)
        {
            try
            {
                string[] vlaue_list = new string[containertextboxcount + 1];
                vlaue_list[containertextboxcount - 2] = ".";
                vlaue_list[containertextboxcount - 1] = "0";
                vlaue_list[containertextboxcount]     = "0";
                foreach (Control control in Controls)
                {
                    containertextbox textbox = (containertextbox)control;
                    if (textbox.Tag.ToString().NotIsNullOrEmpty() && textbox.Tag.ToString().IsInt())
                    {
                        int box_tag = textbox.Tag.ToString().ToInt();
                        if (box_tag > containertextboxcount - 3)
                        {
                            box_tag = box_tag + 1;
                        }
                        vlaue_list[box_tag] = textbox.Text.ToString();
                    }
                }

                string value_new = "";
                foreach (string s in vlaue_list)
                {
                    if (s.NotIsNullOrEmpty() && s.Trim() != "")
                    {
                        value_new = value_new.Trim() + s.Trim();
                    }
                }
                this.Tag = add_xsd(tag_to_string(value_new));


                containermoneyall all = ((containermoneyall)Parent);
                foreach (Control control in all.Controls)
                {
                    if (control.Name == "containeredit1")
                    {
                        ((containeredit)control).Text = this.Tag.ToString() + " / " + this.Tag.ToString().ToLong().ToString() + " / " + tag_to_string(value_new).Trim();
                    }
                }
            }
            catch (Exception ex)
            {
                ex.errormess();
            }
        }
Пример #3
0
        private void containerinto_Leave(object sender, EventArgs e)
        {
            //get_TAG();
            //if (Tag.ToString().ToDouble() != 0)
            //{ get_TAG(); }
            //Tag = tag_string;
            containermoneyall moneyall = (containermoneyall)Parent;

            foreach (Control control in moneyall.Controls)
            {
                if (control is containerinto)
                {
                    if (control.Name != Name)
                    {
                        if (control.Tag.ToString().ToDouble() != 0)
                        {
                            this.Tag = "0";// public_value;
                        }
                    }
                }
            }
            get_TAG();

            if (this.Tag.ToString().ToDouble() < 0)
            {
                foreach (Control control in Controls)
                {
                    if (control is containertextbox)
                    {
                        ((containertextbox)control).ForeColor = Color.Red;
                    }
                }
            }
            else
            {
                foreach (Control control in Controls)
                {
                    if (control is containertextbox)
                    {
                        ((containertextbox)control).ForeColor = Color.Black;
                    }
                }
            }
        }
Пример #4
0
        public void set_TAG(int wz, string set_value)
        {
            try
            {
                string public_value_temp = tag_to_string(this.Tag.ToString());// "000000000000000";
                //// 将Tag的值补充为15位(不带小数点)字符串
                //string tag_public_values = tag_to_string();

                if (set_value == ".")
                {
                    //如果点击小数点的话,直接跳到“角”位上
                    foreach (Control control in Controls)
                    {
                        containertextbox textbox = (containertextbox)control;
                        if (textbox.Tag.ToString().NotIsNullOrEmpty() && textbox.Tag.ToString().IsInt())
                        {
                            int tag_int = textbox.Tag.ToString().ToInt();

                            if (tag_int == containertextboxcount - 2)
                            {
                                textbox.Focus();
                            }
                        }
                    }
                    //如果点击小数点的话,直接跳到“角”位上
                }
                else
                {
                    public_value_temp = public_value_temp.Substring(0, wz) + set_value.Trim() + public_value_temp.Substring(wz + 1);

                    this.Tag = public_value_temp;
                    foreach (Control control in Controls)
                    {
                        containertextbox textbox = (containertextbox)control;
                        if (textbox.Tag.ToString().NotIsNullOrEmpty() && textbox.Tag.ToString().IsInt())
                        {
                            //遍历所有的Textbox
                            int textbox_tag = textbox.Tag.ToString().ToInt();
                            if (textbox_tag < wz)
                            {
                                public_value_temp = public_value_temp.Substring(0, wz) + set_value.Trim() + public_value_temp.Substring(wz + 1);
                            }
                        }
                    }
                    //将public_valuea_temp加上小数点,再拷贝到tag
                    this.Tag = add_xsd(public_value_temp);
                    //get_TAG();
                }


                containermoneyall all = ((containermoneyall)Parent);
                foreach (Control control in all.Controls)
                {
                    if (control.Name == "containeredit1")
                    {
                        ((containeredit)control).Text = this.Tag.ToString() + " " + this.Tag.ToString().ToLong().ToString();
                    }
                }
            }

            catch (Exception ex)
            {
                ex.errormess();
            }
        }