Example #1
0
    /// <summary>
    /// Creates a new MyComboBox control inside MyGroupBox container, associated
    /// to a specified Enum type and at some location.
    /// </summary>
    /// <remarks>
    /// The control is added to the form container with its tab-index property
    /// automatically assigned (see <see cref="NextTabIndex"/>).
    /// </remarks>
    ///
    protected MyComboBox NewEnumField(MyGroupBox box, float left, float top,
                                      float width, Type type)
    {
        if (Em.IsTextUI)
        {
            --left;
        }

        MyComboBox combo = new MyComboBox()
        {
            AutoSize = width <= 0 ? true : false,
            Left     = (int)(left * Em.Width),
            Top      = (int)(top * Em.Height) - (Em.IsGUI ? 3 : 0),
            TabStop  = true,
            TabIndex = NextTabIndex,
            Parent   = box,
        };

        if (width > 0)
        {
            combo.Width = (int)(width * Em.Width);
        }

        combo.AddEnum(type);

        return(combo);
    }