Example #1
0
        private void InfoFormInfo()
        {
            try
            {
                _FormInfo = new FormCfgInfo();
                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.Load(AppDomain.CurrentDomain.BaseDirectory + "FormCfg.xml");
                XmlNode node = xmlDoc.SelectSingleNode(string.Format("/Forms/{0}", _FormName));
                _FormInfo.CellHCount = int.Parse(node.Attributes["CellHCount"].Value);
                _FormInfo.CellVCount = int.Parse(node.Attributes["CellVCount"].Value);
                _FormInfo.CellHDis   = int.Parse(node.Attributes["CellHDis"].Value);
                _FormInfo.CellVDis   = int.Parse(node.Attributes["CellVDis"].Value);
                _FormInfo.CellHeight = int.Parse(node.Attributes["CellHeight"].Value);
                _FormInfo.CellWidth  = int.Parse(node.Attributes["CellWidth"].Value);

                this.Text = node.Attributes["Name"].Value;
            }
            catch (System.Exception ex)
            {
                _FormInfo = null;
                MessageBox.Show("加载窗体配置失败!" + ex.Message);
                this.Close();
            }
        }
Example #2
0
        public SField(FormCfgInfo formCfgInfo, string name, int index, bool hasLabel, SInputType inputType, object data)
        {
            _FormCfgInfo = formCfgInfo;
            Name         = name;
            _HasLabel    = hasLabel;
            if (_HasLabel)
            {
                _LabelCtrl           = new Label();
                _LabelCtrl.AutoSize  = false;
                _LabelCtrl.TextAlign = ContentAlignment.MiddleLeft;
            }
            _InputType = inputType;
            Name       = name;
            _Index     = index;

            switch (_InputType)
            {
            case SInputType.String:
            {
                TextBox textBox = new TextBox();
                textBox.Text = data as string;
                _InputCtrl   = textBox;
                break;
            }

            case SInputType.MultiLine:
            {
                TextBox textBox = new TextBox();
                textBox.Text      = data as string;
                textBox.Multiline = true;
                _InputCtrl        = textBox;
                break;
            }

            case SInputType.Decimal:
            {
                TextBox textBox = new TextBox();
                textBox.Text = data as string;
                _InputCtrl   = textBox;
                break;
            }

            case SInputType.Combo:
            {
                ComboBox comboBox = new ComboBox();
                comboBox.DataSource = data;
                _InputCtrl          = comboBox;
                break;
            }

            case SInputType.Date:
            {
                ForKids.UI.SCtrls.SDateTimePicker sDateTimePicker = new ForKids.UI.SCtrls.SDateTimePicker();
                sDateTimePicker.Text = (data == null ? DateTime.Now.ToString() : data as string);
                _InputCtrl           = sDateTimePicker;
                break;
            }

            case SInputType.Image:
            {
                PictureBox picBox = new PictureBox();
                picBox.SizeMode = PictureBoxSizeMode.StretchImage;
                picBox.Image    = data as Image;
                _InputCtrl      = picBox;
                break;
            }
            }
            if (_InputType != SInputType.Image)
            {
                _InputCtrl.AutoSize = false;
            }
        }
Example #3
0
        public SField(FormCfgInfo formCfgInfo, string name, int index, bool hasLabel, SInputType inputType, object data)
        {
            _FormCfgInfo = formCfgInfo;
            Name         = name;
            _HasLabel    = hasLabel;
            if (_HasLabel)
            {
                _LabelCtrl           = new Label();
                _LabelCtrl.AutoSize  = false;
                _LabelCtrl.TextAlign = ContentAlignment.MiddleLeft;
            }
            _InputType = inputType;
            Name       = name;
            _Index     = index;

            switch (_InputType)
            {
            case SInputType.String:
            case SInputType.Decimal:
            case SInputType.Int:
            case SInputType.Double:
            {
                TextBox textBox = new TextBox();
                textBox.Text = data as string;
                _InputCtrl   = textBox;
                break;
            }

            case SInputType.MultiLine:
            {
                TextBox textBox = new TextBox();
                textBox.Text      = data as string;
                textBox.Multiline = true;
                _InputCtrl        = textBox;
                break;
            }

            case SInputType.Boolean:
            case SInputType.Combo:
            {
                ComboBox comboBox = new ComboBox();
                comboBox.DropDownStyle = ComboBoxStyle.DropDownList;
                if (data != null)
                {
                    string[] items = data.ToString().Split(';');
                    foreach (string item in items)
                    {
                        comboBox.Items.Add(item);
                    }
                }
                _InputCtrl = comboBox;
                break;
            }

            case SInputType.Date:
            {
                ForKids.UI.SCtrls.SDateTimePicker sDateTimePicker = new ForKids.UI.SCtrls.SDateTimePicker();
                sDateTimePicker.Text = (data == null ? DateTime.Now.ToString() : data as string);
                _InputCtrl           = sDateTimePicker;
                break;
            }

            case SInputType.Image:
            {
                PictureBox picBox = new PictureBox();
                picBox.SizeMode          = PictureBoxSizeMode.Zoom;
                picBox.BackColor         = Color.FromKnownColor(KnownColor.AppWorkspace);
                picBox.Image             = data as Image;
                _InputCtrl               = picBox;
                picBox.MouseDoubleClick += new MouseEventHandler(picBox_MouseDoubleClick);
                break;
            }
            }
            if (_InputType != SInputType.Image)
            {
                _InputCtrl.AutoSize = false;
            }
        }