Exemplo n.º 1
0
        public AttributeWidgetEnum(XmlElement element, string attrName, IValidationProvider val) : base(element, attrName, val)
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

            combo = new ComboBox();
            string curVal = element.GetAttribute(attrName);

            combo.Items.Add(string.Empty);
            combo.Items.AddRange(val.GetEnumValues(element, attrName));
            combo.SelectedItem              = curVal;
            combo.DropDownStyle             = ComboBoxStyle.DropDownList;
            combo.Height                   -= 2;
            combo.SelectionChangeCommitted += new EventHandler(ComboSelChanged);

            int xstart = deleteButton.Location.X + deleteButton.Width;

            combo.Location = new Point(xstart + 5, 0);
            // TODO: L: why is this -25 ??
            combo.Width   = ClientRectangle.Width - combo.Location.X - 25;
            combo.Anchor |= AnchorStyles.Right;
            Controls.Add(combo);
        }