Ejemplo n.º 1
0
        public StaticListDropDownPropertyControl(PropertyControlInfo propInfo)
            : base(propInfo)
        {
            SuspendLayout();

            this.header             = new HeaderLabel();
            this.header.Name        = "header";
            this.header.RightMargin = 0;
            this.header.Text        = this.DisplayName;

            this.comboBox                       = new ComboBox();
            this.comboBox.Name                  = "comboBox";
            this.comboBox.FlatStyle             = FlatStyle.System;
            this.comboBox.SelectedIndexChanged += new EventHandler(ComboBox_SelectedIndexChanged);
            this.comboBox.DropDownStyle         = ComboBoxStyle.DropDownList;

            foreach (object choice in Property.ValueChoices)
            {
                string valueText = propInfo.GetValueDisplayName(choice);
                this.comboBox.Items.Add(valueText);
            }

            this.descriptionText          = new Label();
            this.descriptionText.Name     = "descriptionText";
            this.descriptionText.AutoSize = false;
            this.descriptionText.Text     = this.Description;

            this.Controls.AddRange(
                new Control[]
            {
                this.header,
                this.comboBox,
                this.descriptionText
            });

            ResumeLayout(false);
            PerformLayout();
        }
Ejemplo n.º 2
0
        public StaticListRadioButtonPropertyControl(PropertyControlInfo propInfo)
            : base(propInfo)
        {
            SuspendLayout();

            this.header             = new HeaderLabel();
            this.header.Name        = "header";
            this.header.RightMargin = 0;
            this.header.Text        = this.DisplayName;

            object[] valueChoices = Property.ValueChoices; // cache this to avoid making N copies
            this.radioButtons = new RadioButton[valueChoices.Length];

            for (int i = 0; i < this.radioButtons.Length; ++i)
            {
                this.radioButtons[i]                 = new RadioButton();
                this.radioButtons[i].Name            = "radioButton" + i.ToString(CultureInfo.InvariantCulture);
                this.radioButtons[i].FlatStyle       = FlatStyle.System;
                this.radioButtons[i].CheckedChanged += new EventHandler(RadioButton_CheckedChanged);

                string valueText = propInfo.GetValueDisplayName(valueChoices[i]);
                this.radioButtons[i].Text = valueText;
            }

            this.descriptionText          = new Label();
            this.descriptionText.Name     = "descriptionText";
            this.descriptionText.AutoSize = false;
            this.descriptionText.Text     = this.Description;

            this.Controls.Add(this.header);
            this.Controls.AddRange(this.radioButtons);
            this.Controls.Add(this.descriptionText);

            ResumeLayout(false);
            PerformLayout();
        }