Input for WinForms | ComponentOne
Appearance and Styling / NumericEdit
In This Topic
    NumericEdit
    In This Topic

    Input provides various properties for customizing the appearance and styling the Input control, so that you can generate the NumericEdit control as per your requirement and change the look and feel of the application you are creating.

    Appearance

    You can add an icon or change the font settings of the NumericEdit control.

    The following code snippet shows how to add an icon or change the font settings of NumericEdit:

    C#
    Copy Code
    // Enhance the appearance of NumericEdit
    numericEdit.Font = new System.Drawing.Font("Arial Black", 11F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point);
    numericEdit.Icon = new C1.Framework.C1BitmapIcon(null, new System.Drawing.Size(32, 32), System.Drawing.Color.Transparent, Image.FromFile(@"Resources\numeric-icon.png"));
    

    Styling

    The C1NumericEdit class provides the BackColor and ForeColor properties to set the background and foreground colors, respectively. Besides these, it also provides the Styles property to apply styling to different states of the control such as Default, Disabled, Hot, HotPressed, and Pressed.

    The following image showcases styling applied to the NumericEdit control.

    To apply styling to the NumericEdit control, use the following code. Here, we apply styling to the NumericEdit control and its elements by setting background color, foreground, font style, and borders.

    C#
    Copy Code
    //Style NumericEdit control
    c1NumericEdit1.BackColor = System.Drawing.Color.Tan;
    c1NumericEdit1.Styles.Border = new C1.Framework.Thickness(3, 3, 3, 3); 
    c1NumericEdit1.Styles.Default.BorderColor = System.Drawing.Color.Maroon;
    //Style font
    c1NumericEdit1.Font = new System.Drawing.Font("Arial Black", 11F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
    //Style NumericEdit elements
    c1NumericEdit1.Styles.Button.Default.BackColor = System.Drawing.Color.Khaki;
    c1NumericEdit1.Styles.Button.Default.BorderColor = System.Drawing.Color.Black;
    c1NumericEdit1.Styles.Button.Default.ForeColor = System.Drawing.Color.DarkSlateGray;