示例#1
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();
            }
        }
示例#2
0
        public void get_TAG()
        {
            try
            {
                //if (!this.Tag.ToString().IsDecimal()) { MessageBox.Show(this.Tag.ToString() + "请输入正确的数字!"); return; }

                // 将Tag的值补充为15位(不带小数点)字符串
                string tag_public_values = tag_to_string(this.Tag.ToString());
                //MessageBox.Show(this.Tag.ToString()+" / "+tag_public_values);
                bool l_jytt = true;
                if (this.Tag.ToString().ToDecimal() == 0)
                {
                    l_jytt = false;
                }

                int begin_i = 0;//从15位字符串第一位开始往后顺,第一个不为0的数是开始的位置
                for (int i = 0; i < containertextboxcount; i++)
                {
                    if (tag_public_values.Trim().Substring(i, 1) != "0")
                    {
                        begin_i = i;
                        break;
                    }
                }
                //MessageBox.Show("是否为0:"+l_jytt.ToString()+" / 开始截取的位置:"+ begin_i.ToString());
                foreach (Control control in Controls)
                {
                    if (control is containertextbox)
                    {
                        containertextbox textbox = (containertextbox)control;
                        if (textbox.Tag.ToString().NotIsNullOrEmpty() && textbox.Tag.ToString().IsInt())
                        {
                            int textbox_tag_int = textbox.Tag.ToString().ToInt();//当前的textbox的tag值

                            if (textbox_tag_int >= begin_i && l_jytt)
                            {
                                //MessageBox.Show("tag_public_values的值:" + tag_public_values + " / 开始截取的位置:" + textbox_tag_int.ToString());
                                textbox.Text = tag_public_values.Trim().Substring(textbox_tag_int, 1);// this.Tag.ToString().Substring(tag_int, 1);
                            }
                            else
                            {
                                textbox.Text = "";
                            }
                        }
                    }
                }


                // bool l_jytt = true;
                //if (this.Tag.ToString().ToDecimal()==0) { l_jytt = false; }

                // long top_int = tag_string.ToString().ToLong();

                // int length_int = top_int.ToString().Length;

                // foreach (Control control in Controls)
                // {
                //     if (control is containertextbox)
                //     {
                //         containertextbox textbox = (containertextbox)control;
                //         if (textbox.Tag.ToString().NotIsNullOrEmpty() && textbox.Tag.ToString().IsInt())
                //         {
                //             int tag_int = textbox.Tag.ToString().ToInt();

                //             int wz_jytt = Tag.ToString().Trim().Length - 2 - 1 - length_int - 1;

                //             //MessageBox.Show(Tag.ToString().Trim().Length.ToString() + "  " + tag_int.ToString() + "  " + wz_jytt.ToString());
                //             if (wz_jytt < tag_int && l_jytt)
                //             {
                //                 textbox.Text = this.Tag.ToString().Substring(tag_int, 1);
                //             }
                //             else
                //             { textbox.Text = ""; }

                //         }
                //     }
                // }
            }

            catch (Exception ex)
            {
                ex.errormess();
            }
        }
示例#3
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();
            }
        }