示例#1
0
        void AddNumberBox(FieldBind field)
        {
            string         name = field.GetEditorName();
            LabeledTextbox c    = new LabeledTextbox(name);

            c.Name = name + "_TB";

            c.Text = field.GetValue().ToString();

            field.GetDataAction = () => {
                if (int.TryParse(c.Text, out int r))
                {
                    return(r);
                }
                else
                {
                    return(0);
                }
            };
            field.Reverted += (object o) => { c.Text = o.ToString(); };
            //c.TextChanged += (object sender, EventArgs e) =>
            //{
            //    field.data = c.Text;
            //};
            this.flowPanel.Controls.Add(c);
        }
示例#2
0
        void AddTextBox(FieldBind field)
        {
            string         name = field.GetEditorName();
            LabeledTextbox c    = new LabeledTextbox(name);

            c.Name = name + "_TB";

            c.Text = (string)field.GetValue();

            field.GetDataAction = () => { return(c.Text); };
            field.Reverted     += (object o) => { c.Text = (string)o; };
            //c.TextChanged += (object sender, EventArgs e) =>
            //{
            //    field.data = c.Text;
            //};
            this.flowPanel.Controls.Add(c);
        }