# Bunifu Flat Button

Working on a flat design  concept UI? Achieve stylish looking flat buttons in your UI with Bunifu Flat Buttons. You can do this at design time and at run time.&#x20;

## **Adding Bunifu Flat Button at Design Time**

Ensure you have your form open then locate Bunifu Flat Button in your toolbox.&#x20;

![](https://downloads.intercomcdn.com/i/o/72827746/5b9726436eb8299f0287eb66/1-6\[1].png)

## **Adding Bunifu Flat Button at Runtime**

We will use form Load event to add the following code:

### **C# code**

```
private void Form1_Load(object sender, EventArgs e)
{
    var newButton = new Bunifu.Framework.UI.BunifuFlatButton();
    this.Controls.Add(newButton);
}
```

**VB.NET code**&#x20;

```
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load    

    Dim newButton As New Bunifu.Framework.UI.BunifuFlatButton
    Controls.Add(newButton)

End Sub
```

With above code you should see something like this:

![](https://downloads.intercomcdn.com/i/o/72828168/9626d007c07edc080ab43edc/2-6\[1].png)

## Custom Properties

We have three sets of custom properties

### **Color properties**

* &#x20;`colbackground`-  This property allows you to set the background color of the button (it will take effect whenever you hover the button for the first time).
* &#x20;`colhover` **-** This property sets the color of the button when hovered
* &#x20;`colselected`& `Activecolor`- This property sets the color of the button when clicked
* &#x20;`Normalcolor`**-** This property sets the default color of the button&#x20;
* &#x20;`OnHoverColor`- This property works the same way as colhover property&#x20;
* &#x20;`OnHoverTextColor`-  This property allows you to set the color of the text on the button when hovered

### **Image Properties**

* &#x20;`limage` or **`IconImage`** - This property allows you to set an image on the left side of the button
* &#x20;`rimage` or **`Iconimage_right`** - This property allows you to set an image on the right side of the button

**Visibility Properties**

* &#x20;`iconVisible` and **`iconRightVisible`** -  This property allows you to choose whether to show or hide the image on the button
* &#x20;`iconZoom` - This property allows you to set the zoom of the image

The sample code below show the properties in action:

{% tabs %}
{% tab title="C#" %}

```
private void Form1_Load(object sender, EventArgs e){    
    this.bunifuFlatButton1.Normalcolor = Color.Purple;    
    this.bunifuFlatButton1.OnHovercolor = Color.Red;    
    this.bunifuFlatButton1.Activecolor = Color.Black;    
    this.bunifuFlatButton1.colbackground = Color.Blue;    
    this.bunifuFlatButton1.colhover = Color.Red;    
    this.bunifuFlatButton1.colselected = Color.Red;    
    this.bunifuFlatButton1.Activecolor = Color.Yellow;    
    this.bunifuFlatButton1.Iconcolor = Color.Violet;    
    this.bunifuFlatButton1.IconZoom = 100;    
    this.bunifuFlatButton1.IconRightVisible = false;
}
```

{% endtab %}

{% tab title="VB.NET" %}

```
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load    
    BunifuFlatButton1.Normalcolor = Color.Purple;
    BunifuFlatButton1.OnHovercolor = Color.Red;
    BunifuFlatButton1.Activecolor = Color.Black;    
    BunifuFlatButton1.colbackground = Color.Blue;
    BunifuFlatButton1.colhover = Color.Red;
    BunifuFlatButton1.colselected = Color.Red;
    BunifuFlatButton1.Activecolor = Color.Yellow;
    BunifuFlatButton1.Iconcolor = Color.Violet;    
    BunifuFlatButton1.IconZoom = 100;
    BunifuFlatButton1.IconRightVisible = false;
End Sub
```

{% endtab %}
{% endtabs %}

If you did it correctly you should see something like this.&#x20;

![](https://downloads.intercomcdn.com/i/o/72830286/fa3c569f72de46eea2128a25/Screenshot_3\[1].png)

That's it!

We hope you will enjoy using Bunifu Flat Button control and that it will help you create better user experience for your users.&#x20;

Should you have feedback or suggestions please send us via chat on the bottom right corner of the screen.
