Ejemplo n.º 1
0
        /// <summary>
        /// inputpannel 그룹에 선택된 그룹만 보이게 한다.
        /// </summary>
        /// <param name="inp"></param>
        /// <param name="strGrpNames"></param>
        public static void Invoke_InputPanel_Group_Collapsed(C1InputPanel inp, string [] strGrpNames)
        {
            if (inp.InvokeRequired)
            {
                inp.Invoke(new delInvoke_InputPanel_Group_Collapsed(Invoke_InputPanel_Group_Collapsed), new object[] { inp, strGrpNames });
                return;
            }



            InputGroupHeader grp = null;

            //일단 전부 않보이게..
            foreach (InputComponent c in inp.Items)
            {
                grp = c as InputGroupHeader;

                if (grp != null)
                {
                    grp.Height     = 0;
                    grp.Collapsed  = true;
                    grp.Visibility = C1.Win.C1InputPanel.Visibility.Hidden;
                }
            }


            //대상만 보이게..
            foreach (InputComponent c in inp.Items)
            {
                grp = c as InputGroupHeader;

                if (grp != null)
                {
                    foreach (string strGrpName in strGrpNames)
                    {
                        if (grp.Name == strGrpName)
                        {
                            //grp.Height = -1;
                            grp.Collapsed  = false;
                            grp.Visibility = C1.Win.C1InputPanel.Visibility.Visible;
                            break;
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// InputComboBox에 string 배열의 값을 Group으로 추가한다.
        /// </summary>
        /// <param name="inp"></param>
        /// <param name="cmb"></param>
        /// <param name="strItems"></param>
        /// <returns></returns>
        public static void Invoke_InputComboBox_Items_AddGroups(C1InputPanel inp,
                                                                C1.Win.C1InputPanel.InputComboBox cmb, string[] strGroups)
        {
            if (inp.InvokeRequired)
            {
                inp.Invoke(new delInvoke_InputComboBox_Items_AddItems(Invoke_InputComboBox_Items_AddGroups), new object[] { inp, cmb, strGroups });
                return;
            }

            InputGroupHeader ig;

            foreach (string str in strGroups)
            {
                ig      = new InputGroupHeader();
                ig.Text = str;
                cmb.Items.Add(ig);
            }
        }
Ejemplo n.º 3
0
        private void AddInputComponent(XmlNode node)
        {
            switch (node.Name)
            {
            case "C1InputButton":
                InputButton button = new InputButton();
                ReadCommonProperties(node, button);
                button.Text         = XmlUtil.Read(node, "text", String.Empty);
                button.Image        = XmlUtil.ReadImage(node, "image");
                button.CheckOnClick = XmlUtil.Read(node, "toggle", false);
                button.Pressed      = XmlUtil.Read(node, "pressed", false);
                c1InputPanel1.Items.Add(button);
                break;

            case "C1InputCheckBox":
                InputCheckBox checkBox = new InputCheckBox();
                ReadCommonProperties(node, checkBox);
                checkBox.Checked    = XmlUtil.Read(node, "checked", false);
                checkBox.ThreeState = XmlUtil.Read(node, "threeState", false);
                checkBox.Text       = XmlUtil.Read(node, "text", String.Empty);
                c1InputPanel1.Items.Add(checkBox);
                break;

            case "C1InputComboBox":
                InputComboBox comboBox = new InputComboBox();
                ReadCommonProperties(node, comboBox, true);
                comboBox.DropDownStyle = XmlUtil.Read(node, "dropDownList", false)
                        ? InputComboBoxStyle.DropDownList : InputComboBoxStyle.DropDown;
                comboBox.MaxDropDownItems  = XmlUtil.Read(node, "maxDropDownItems", 8);
                comboBox.GripHandleVisible = XmlUtil.Read(node, "gripHandle", false);
                comboBox.Text      = XmlUtil.Read(node, "text", String.Empty);
                comboBox.Width     = XmlUtil.Read(node, "width", 100);
                comboBox.MaxLength = XmlUtil.Read(node, "maxLength", 250);

                // parse combobox options
                string   options = XmlUtil.Read(node, "options", String.Empty);
                string[] optList = options.Split(',');
                for (int i = 0; i < optList.Length; i++)
                {
                    InputOption option = new InputOption();
                    option.Text = optList[i];
                    comboBox.Items.Add(option);
                }

                c1InputPanel1.Items.Add(comboBox);
                break;

            case "C1InputDatePicker":
                InputDatePicker datePicker = new InputDatePicker();
                ReadCommonProperties(node, datePicker, true);
                datePicker.Format    = XmlUtil.Read(node, "format", String.Empty);
                datePicker.ShowToday = XmlUtil.Read(node, "showToday", true);
                datePicker.Width     = XmlUtil.Read(node, "width", 100);
                c1InputPanel1.Items.Add(datePicker);
                break;

            case "C1InputGroup":
                InputGroupHeader header = new InputGroupHeader();
                header.Text        = XmlUtil.Read(node, "text", String.Empty);
                header.Collapsible = XmlUtil.Read(node, "collapsible", false);
                header.Collapsed   = XmlUtil.Read(node, "collapsed", false);
                header.Height      = XmlUtil.Read(node, "height", 24);
                c1InputPanel1.Items.Add(header);
                break;

            case "C1InputImage":
                InputImage image = new InputImage();
                ReadCommonProperties(node, image);
                image.Image = XmlUtil.ReadImage(node, "image");
                c1InputPanel1.Items.Add(image);
                break;

            case "C1InputLabel":
                InputLabel label = new InputLabel();
                ReadCommonProperties(node, label);
                label.Text     = XmlUtil.Read(node, "text", String.Empty);
                label.WordWrap = XmlUtil.Read(node, "wordwrap", false);
                c1InputPanel1.Items.Add(label);
                break;

            case "C1InputRadioButton":
                InputRadioButton radioButton = new InputRadioButton();
                ReadCommonProperties(node, radioButton);
                radioButton.Checked   = XmlUtil.Read(node, "checked", false);
                radioButton.GroupName = XmlUtil.Read(node, "groupName", String.Empty);
                radioButton.Text      = XmlUtil.Read(node, "text", String.Empty);
                c1InputPanel1.Items.Add(radioButton);
                break;

            case "C1InputSeparator":
                InputSeparator separator = new InputSeparator();
                ReadCommonProperties(node, separator);
                c1InputPanel1.Items.Add(separator);
                break;

            case "C1InputTextBox":
                InputTextBox textBox = new InputTextBox();
                ReadCommonProperties(node, textBox, true);
                textBox.Text      = XmlUtil.Read(node, "text", String.Empty);
                textBox.Width     = XmlUtil.Read(node, "width", 100);
                textBox.MaxLength = XmlUtil.Read(node, "maxLength", 250);
                c1InputPanel1.Items.Add(textBox);
                break;

            case "C1InputNumericBox":
                InputNumericBox numBox = new InputNumericBox();
                ReadCommonProperties(node, numBox, true);
                numBox.Format    = XmlUtil.Read(node, "format", string.Empty);
                numBox.Text      = XmlUtil.Read(node, "value", String.Empty);
                numBox.Increment = Decimal.Parse(XmlUtil.Read(node, "step", "1"));
                numBox.Width     = XmlUtil.Read(node, "width", 100);
                c1InputPanel1.Items.Add(numBox);
                break;

            case "C1InputControlHost":
                string className = XmlUtil.Read(node, "control", String.Empty);
                if (!String.IsNullOrEmpty(className))
                {
                    string qualifiedTypeName = typeof(Control).AssemblyQualifiedName;
                    qualifiedTypeName = qualifiedTypeName.Replace(".Control", "." + className);
                    Type controlType = Type.GetType(qualifiedTypeName, true);
                    if (controlType != null)
                    {
                        ConstructorInfo ci = controlType.GetConstructor(new Type[0]);
                        if (ci != null)
                        {
                            Control control = ci.Invoke(new object[0]) as Control;
                            if (control != null)
                            {
                                InputControlHost controlHost = new InputControlHost(control);
                                ReadCommonProperties(node, controlHost);
                                c1InputPanel1.Items.Add(controlHost);
                            }
                        }
                    }
                }
                break;

            case "C1InputLinkLabel":
                string linkText = XmlUtil.Read(node, "text", String.Empty);
                if (!String.IsNullOrEmpty(linkText))
                {
                    InputHtmlLabel htmlLabel = new InputHtmlLabel();
                    ReadCommonProperties(node, htmlLabel);
                    string linkHRef = XmlUtil.Read(node, "href", String.Empty);
                    htmlLabel.Text         = "<a href='" + linkHRef + "'>" + linkText + "</a>";
                    htmlLabel.LinkClicked += new C1.Win.C1InputPanel.LinkClickedEventHandler(htmlLabel_LinkClicked);
                    c1InputPanel1.Items.Add(htmlLabel);
                }
                break;

            default:
                InputLabel unknown = new InputLabel();
                ReadCommonProperties(node, unknown);
                string text = XmlUtil.Read(node, "text", String.Empty);
                if (text.Length > 0)
                {
                    unknown.Text = "< " + node.Name + ", Text = \"" + text + "\" >";
                }
                else
                {
                    unknown.Text = "< " + node.Name + " >";
                }
                c1InputPanel1.Items.Add(unknown);
                break;
            }
        }
Ejemplo n.º 4
0
        public PropertyList(ArrayList properties)
        {
            this.ChildSpacing = new Size(2, 2);
            this.Margin       = new Padding(0);
            this.Padding      = new Padding(0);
            this.SuspendLayout();

            for (int i = 0; i < properties.Count; i++)
            {
                Association a = properties[i] as Association;

                if (a == null)
                {
                    string s = properties[i] as string;
                    if (s.ToLower().Equals("separator"))
                    {
                        InputSeparator sep = new InputSeparator();
                        this.Items.Add(sep);
                    }
                    else if (s.ToLower().Equals("colbreak"))
                    {
                        this.Items[this.Items.Count - 1].Break = BreakType.Column;
                    }
                    else
                    {
                        InputGroupHeader gh = new InputGroupHeader();
                        gh.Text      = s;
                        gh.Height    = unitHeight;
                        gh.BackColor = Color.Transparent;
                        this.Items.Add(gh);
                    }
                }
                else if (a.Descriptor.PropertyType == Type.GetType("System.Boolean"))
                {
                    InputCheckBox chk = new InputCheckBox();
                    chk.Height  = unitHeight;
                    chk.Checked = (bool)a.Value;
                    chk.Tag     = a;
                    if (string.IsNullOrEmpty(a.LongName))
                    {
                        chk.Text = a.Descriptor.Name + " ";
                    }
                    else
                    {
                        chk.Text = a.LongName + " ";
                    }
                    chk.CheckedChanged += new EventHandler(chk_CheckedChanged);
                    this.Items.Add(chk);
                }
                else
                {
                    InputLabel lab = new InputLabel();
                    lab.VerticalAlign = InputContentAlignment.Center;
                    lab.Height        = unitHeight;
                    lab.Width         = labelWidth;
                    if (string.IsNullOrEmpty(a.LongName))
                    {
                        lab.Text = a.Descriptor.Name;
                    }
                    else
                    {
                        lab.Text = a.LongName;
                    }
                    this.Items.Add(lab);
                    if (a.Descriptor.PropertyType.IsEnum)
                    {
                        InputComboBox box = new InputComboBox();
                        box.Height        = unitHeight;
                        box.DropDownStyle = InputComboBoxStyle.DropDownList;
                        BindingFlags flags  = BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly;
                        FieldInfo[]  fields = a.Descriptor.PropertyType.GetFields(flags);
                        box.Tag  = a;
                        box.Text = a.Value.ToString();
                        box.SelectedIndexChanged += new EventHandler(box_SelectedIndexChanged);
                        for (int f = 0; f < fields.Length; f++)
                        {
                            var field = fields[f];
                            if (a.AllowedValues == null || a.AllowedValues.Contains(field.Name))
                            {
                                InputOption ic = new InputOption();
                                ic.Text = field.GetValue(field).ToString();
                                ic.Tag  = field;
                                box.Items.Add(ic);
                            }
                        }
                        this.Items.Add(box);
                    }
                    else if (a.Descriptor.PropertyType == Type.GetType("System.DateTime"))
                    {
                        InputDatePicker dp = new InputDatePicker();
                        dp.Height     = unitHeight;
                        dp.Value      = (DateTime)a.Value;
                        dp.Tag        = a;
                        dp.LostFocus += new EventHandler(date_LostFocus);
                        this.Items.Add(dp);
                    }
                    else if (a.Descriptor.PropertyType == Type.GetType("System.TimeSpan"))
                    {
                        InputTimePicker tp = new InputTimePicker();
                        tp.Height     = unitHeight;
                        tp.Value      = (TimeSpan)a.Value;
                        tp.Tag        = a;
                        tp.LostFocus += new EventHandler(time_LostFocus);
                        this.Items.Add(tp);
                    }
                    else if (a.Descriptor.PropertyType.ToString().Equals("System.Drawing.Color"))
                    {
                        ColorEditorHost ce = new ColorEditorHost();
                        ce.Height        = unitHeight;
                        ce.Width         = 102;
                        ce.SelectedColor = (System.Drawing.Color)a.Value;
                        ce.Tag           = a;
                        ce.LostFocus    += new EventHandler(color_LostFocus);
                        this.Items.Add(ce);
                    }
                    else if (a.Descriptor.PropertyType == Type.GetType("System.Int32"))
                    {
                        InputNumericBox nb = new InputNumericBox();
                        nb.Height        = unitHeight;
                        nb.Width         = 50;
                        nb.Value         = (int)a.Value;
                        nb.Tag           = a;
                        nb.Maximum       = 100000;
                        nb.ValueChanged += new EventHandler(nb_ValueChanged);
                        this.Items.Add(nb);
                    }
                    else if (a.Descriptor.PropertyType == Type.GetType("System.Int16"))
                    {
                        InputNumericBox nb = new InputNumericBox();
                        nb.Height        = unitHeight;
                        nb.Width         = 50;
                        nb.Value         = (short)a.Value;
                        nb.Tag           = a;
                        nb.Maximum       = 100000;
                        nb.ValueChanged += new EventHandler(nb_ValueChanged);
                        this.Items.Add(nb);
                    }
                    else if (a.Descriptor.PropertyType == Type.GetType("System.Int64"))
                    {
                        InputNumericBox nb = new InputNumericBox();
                        nb.Value         = (long)a.Value;
                        nb.Tag           = a;
                        nb.Maximum       = 100000;
                        nb.Height        = unitHeight;
                        nb.Width         = 50;
                        nb.ValueChanged += new EventHandler(nb_ValueChanged);
                        this.Items.Add(nb);
                    }
                    else if (a.Descriptor.PropertyType == Type.GetType("System.Single") || a.Descriptor.PropertyType == Type.GetType("System.Double"))
                    {
                        InputNumericBox nb = new InputNumericBox();
                        nb.Value         = (decimal)Math.Floor((Single)a.Value);
                        nb.Tag           = a;
                        nb.Maximum       = 360;
                        nb.Minimum       = 0;
                        nb.Height        = unitHeight;
                        nb.Width         = 50;
                        nb.ValueChanged += new EventHandler(nb_ValueChanged);
                        this.Items.Add(nb);
                    }
                    else
                    {
                        InputTextBox txt = new InputTextBox();
                        txt.VerticalAlign = InputContentAlignment.Center;
                        txt.Height        = unitHeight;
                        txt.Text          = a.Value.ToString();
                        txt.Tag           = a;
                        txt.LostFocus    += new EventHandler(txt_LostFocus);
                        this.Items.Add(txt);
                    }
                }
            }

            this.Dock = System.Windows.Forms.DockStyle.Fill;
            this.ResumeLayout();
        }