private Image GetIconFromFolder()
{ //get image from a folder by getting its path
string imagePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
@"icons\sample-icon.ico");
//get the image by passing the path to the Image.FromFile() method
var image = Image.FromFile(imagePath);
private void Form_Load(object sender, EventArgs e)
//instantiate the icon button using using Bunifu.UI.WinForms.BunifuButton;
BunifuIconButton iconButton = new BunifuIconButton();
//set the icon button size
iconButton.Size = new Size(52, 52);
iconButton.BackgroundColor = Color.DodgerBlue;
iconButton.BorderColor = Color.DodgerBlue;
//set color contrast on click and on hover
iconButton.ColorContrastOnClick = 40;
iconButton.ColorContrastOnHover = 40;
iconButton.Location = new Point(295, 168);
iconButton.Image = GetIconFromFolder();
//add the icon button in the form
this.Controls.Add(iconButton);