예제 #1
0
파일: FormGenerator.cs 프로젝트: xmatakt/DP
        private static void AddLongTextBox(FlowLayoutPanel flowPanel, Field field, bool?doctorsSide)
        {
            FilledField filledField = GetFilledField(field, doctorsSide);

            FlatRichTextBox textBox = new FlatRichTextBox()
            {
                Width = flowPanel.Width - Value, AutoSize = true, Tag = field
            };

            if (filledField != null)
            {
                textBox.Text = filledField.FieldAnswer.TextValue;
            }

            flowPanel.Controls.Add(textBox);
        }
예제 #2
0
파일: EditFieldForm.cs 프로젝트: xmatakt/DP
        private void UpdateInsightPanel()
        {
            if (fieldType != null)
            {
                insightFlowPanel.Controls.Clear();
                int     width      = insightFlowPanel.Width - 7;
                Control newControl = null;

                switch (fieldType.ID)
                {
                case (int)FieldTypeEnum.Text:
                    newControl = new TextBox()
                    {
                        Width = width
                    };
                    insightFlowPanel.Controls.Add(newControl);
                    break;

                case (int)FieldTypeEnum.LongText:
                    newControl = new FlatRichTextBox()
                    {
                        Width = width, Height = 100
                    };
                    insightFlowPanel.Controls.Add(newControl);
                    break;

                case (int)FieldTypeEnum.RadioBox:
                    List <FieldValue> values = fieldValues;
                    if (values != null)
                    {
                        foreach (var value in values)
                        {
                            newControl = new RadioButton()
                            {
                                Width = width, Checked = false, Text = value.Value
                            };
                            insightFlowPanel.Controls.Add(newControl);
                        }
                    }
                    break;

                case (int)FieldTypeEnum.SelectBox:
                    values = fieldValues;
                    if (values != null)
                    {
                        ComboBox comboBox = new ComboBox()
                        {
                            Width = width, DropDownStyle = ComboBoxStyle.DropDownList
                        };
                        foreach (var value in values)
                        {
                            comboBox.Items.Add(value);
                        }
                        insightFlowPanel.Controls.Add(comboBox);

                        if (comboBox.Items.Count > 0)
                        {
                            comboBox.SelectedIndex = 0;
                        }
                    }
                    break;

                case (int)FieldTypeEnum.CheckBox:
                    values = fieldValues;
                    if (values != null)
                    {
                        foreach (var value in values)
                        {
                            newControl = new CheckBox()
                            {
                                Width = width, Checked = false, Text = value.Value
                            };
                            insightFlowPanel.Controls.Add(newControl);
                        }
                    }
                    break;
                }
            }
        }
예제 #3
0
파일: FormFieldCard.cs 프로젝트: xmatakt/DP
        private void InitializeField()
        {
            if (Field == null)
            {
                return;
            }


            if (Field.FieldType != null)
            {
                Question  = Field.Question;
                fieldName = Field.Name;

                flowPanel.Controls.Clear();
                int     width      = flowPanel.MinimumSize.Width - 7;
                Control newControl = null;

                switch (Field.FieldType.ID)
                {
                case (int)FieldTypeEnum.Text:
                    newControl = new TextBox()
                    {
                        Width = width
                    };
                    //newControl.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
                    //newControl.Enabled = !isPreview;
                    flowPanel.Controls.Add(newControl);
                    break;

                case (int)FieldTypeEnum.LongText:
                    newControl = new FlatRichTextBox()
                    {
                        Width = width, Height = 100
                    };
                    //newControl.Anchor = AnchorStyles.Left | AnchorStyles.Right;
                    //newControl.Enabled = !isPreview;
                    flowPanel.Controls.Add(newControl);
                    break;

                case (int)FieldTypeEnum.RadioBox:
                    ICollection <FieldValue> values = Field.FieldValues;
                    if (values != null)
                    {
                        foreach (var value in values)
                        {
                            newControl = new RadioButton()
                            {
                                Width = width, Checked = false, Text = value.Value
                            };
                            //newControl.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
                            //newControl.Enabled = !isPreview;
                            flowPanel.Controls.Add(newControl);
                        }
                    }
                    break;

                case (int)FieldTypeEnum.SelectBox:
                    values = Field.FieldValues;
                    if (values != null)
                    {
                        ComboBox comboBox = new ComboBox()
                        {
                            Width = width, DropDownStyle = ComboBoxStyle.DropDownList
                        };
                        //comboBox.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
                        //comboBox.Enabled = !isPreview;
                        foreach (var value in values)
                        {
                            comboBox.Items.Add(value);
                        }
                        flowPanel.Controls.Add(comboBox);

                        if (comboBox.Items.Count > 0)
                        {
                            comboBox.SelectedIndex = 0;
                        }
                    }
                    break;

                case (int)FieldTypeEnum.CheckBox:
                    values = Field.FieldValues;
                    if (values != null)
                    {
                        foreach (var value in values)
                        {
                            newControl = new CheckBox()
                            {
                                Width = width, Checked = false, Text = value.Value
                            };
                            //newControl.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
                            //newControl.Enabled = !isPreview;
                            flowPanel.Controls.Add(newControl);
                        }
                    }
                    break;
                }
            }
        }