Bunifu Form Control Box
Maximize, Restore, Minimize, and Close a borderless Windows Form
Last updated
Maximize, Restore, Minimize, and Close a borderless Windows Form
Last updated
Bunifu Form Control Box is a rich set of window control buttons (i.e. Minimize, Maximise/Restore, and Close) that allow you to set the visual state of a borderless Windows form. Icing on the cake:- you don't need to have to code the functionalities of minimizing, maximizing, restoring, or closing the form.
Here's a demo of an application using a Bunifu Form Control Box:
Step 1: First, make sure that the Windows form is borderless. You can do this either by setting the property FormBorderStyle to none
.
Step 2: Add Bunifu Form Control Box. Bunifu Form Control Box can be added to the form by dragging a BunifuFormControlBox
control from the toolbox. It can be placed at the top-right corner of the Windows Form as shown below:
And…that’s it! We have implemented all view states of the form without any code dependency. You can minimize, maximize/restore and close the form at runtime
Optional step: To add a help icon in the form control box, go to the properties of Bunifu Form Control Box and set the HelpBox
property with a true value.
To add a Bunifu Form Control Box to our form at run-time, use the Load
event of your form to run the following code:-
Let's take a deep dive and get insights into the available properties on Bunifu Form Control Box
The below buttons and their properties control the appearance of Bunifu Form Control Box:
The Minimize button looks like a minus sign on the control box. Clicking on the Minimize Button places the Window Form on the taskbar, usually found at the bottom of the screen. Below are option properties found in the minimize button:
1. BackColor
This property gets or sets the background color of the minimize button. It accepts the use of both the HEX and RGB color formats.
2. BorderRadius
This property gets or sets a radius value (integer) that determines the roundness of the Minimize Button
edges. The greater the value, the more rounded the border corners become.
3. Enabled
This property gets or sets a boolean value that determines whether the minimize button performs an action on the Windows form when you click it. A false value prevents the Minimize button from performing its action on the Windows form, while a true value allows the button to execute an action on the form (e.g., hiding the windows form on the taskbar).
4. EnableDefaultAction
This property gets or sets a boolean value that determines whether the Minimize button performs the default action of hiding the Windows form when you click it. A false value disables the action of hiding the Windows form (i.e., placing the Windows form in the taskbar), while a true value enables hiding the form which is its default action.
If you have disabled the default action, you can use the MinimizeCaption
property and access the click event as described in following code:
Result
5. HoverColor
This property gets or sets the back color of the minimize button whenever the mouse hovers over the minimize box. It accepts the use of both the HEX and RGB color formats.
6. Icon
This property gets or sets the image that will be used as the graphical representation for the minimize box. A suitable icon would be the minus sign. To specify an image for the minimize box, click on the ellipsis button located on the value of this property, which will bring up an options dialog box where you can select the desired image.
7. IconAlt
This property gets or sets an alternative image of the current icon to be used as the alternative representation for the minimize box when the form has a different WindowState
.
This property is not suitable for the Minimize, Help and Close caption buttons. However for your creativity, you can specify an alternative icon other than the default minus, help, and close caption buttons.
8. IconColor
This property gets or sets the color of the icon set on the minimize box. It accepts the use of both the HEX and RGB color formats.
9. IconHoverColor
This property gets or sets the color of the icon set on the minimize box whenever the mouse hovers on the minimize box. It accepts the use of both the HEX and RGB color formats.
10.IconPressedColor
This property gets or sets the color of the icon set on the minimize box whenever the user clicks on the minimize box. It accepts the use of both the HEX and RGB color formats.
11.IconSize
This property gets or sets both the height and width of the icon set on the minimize box. The default value is 14 for both the height and width properties.
12.PressedColor
This property gets or sets the back color on the minimize box whenever the user clicks on the minimize box. It accepts the use of both the HEX and RGB color formats.
13.MinimizeBox
This property gets or sets a boolean value that determines if the minimize button is visible. A false value hides the minimize button whereas a true value shows the minimize button
The Maximize/Restore button is in the middle and has two states. When you click on the button, it enlarges the window to occupy the entire screen, and you can restore a window, which reduces the window to the size it was before being maximized. Below are option properties found in the Maximize button:
1. BackColor
This property gets or sets the background color of the maximize button. It accepts the use of both the HEX and RGB color formats.
2. BorderRadius
This property gets or sets a radius value (integer) that determines the roundness of the Maximize Button edges. The greater the value, the more rounded the border corners become.
3. Enabled
This property gets or sets a boolean value that determines whether the Maximize button performs an action on the Windows form when you click it. A false value prevents the Maximize button from performing its action on the Windows form, while a true value allows the button to execute an action on the form (for example, enlarging the Windows form on the user screen to its full size).
4. EnableDefaultAction
This property gets or sets a boolean value that determines whether the maximize button performs the default action of enlarging/restoring the Windows form when you click it. A false value disables the action (if you want to perform other functions with it) while a true value enables the default action.
If you have disabled the default action, you can use the MaximizeCaption
property and access the click event as described in following code:
5. HoverColor
This property gets or sets the back color of the maximize button whenever the mouse hovers over the maximize box. It accepts the use of both the HEX and RGB color formats.
6. Icon
This property gets or sets the image that will be used as the graphical representation for the maximize box. A suitable icon would be the minus sign. To specify an image for the maximize box, click on the ellipsis button located on the value of this property, which will bring up an options dialog box where you can select the desired image.
7. IconAlt
This property gets or sets an alternative image of the current icon to be used as the alternative representation for the maximize box. When the Windows form is maximized to its full size, the alternate icon is displayed.
A suitable alternative icon could be a restore icon which by default is set on the property.
8. IconColor
This property gets or sets a color overlay on the icon set on the maximize box. It accepts the use of both the HEX and RGB color formats.
9. IconHoverColor
This property gets or sets the color of the icon set on the maximize box whenever the mouse hovers on the maximize button. It accepts the use of both the HEX and RGB color formats.
10.IconPressedColor
This property gets or sets the color of the icon set on the maximize box whenever the user clicks on the maximize box. It accepts the use of both the HEX and RGB color formats.
11.IconSize
This property gets or sets both the height and width of the icon set on the maximize box. The default value is 14 for both the height and width properties.
12.PressedColor
This property gets or sets the back color on the maximize box whenever the user clicks on the maximize box. It accepts the use of both the HEX and RGB color formats.
13.MaximizeBox
This property gets or sets a boolean value that determines if the maximize button is visible. A false value hides the maximize button whereas a true
The Close button is the one on the right with the X. Clicking the Close button will close the window or program. Below are option properties found in the close button:
1. BackColor
This property gets or sets the background color of the close button. It accepts the use of both the HEX and RGB color formats.
2. BorderRadius
This property gets or sets a radius value (integer) that determines the roundness of the close button edges. The greater the value, the more rounded the border corners become.
3. Enabled
This property gets or sets a boolean value that determines whether the close button performs an action on the Windows form when you click it. A false value prevents the close button from performing its action on the Windows form, while a true value allows the button to execute an action on the form (e.g., closing the windows form).
4. EnableDefaultAction
This property gets or sets a boolean value that determines whether the close button performs the default action of closing the Windows form when you click it. A false value disables the action of closing so that you can define your own action, while a true value allows the form to close, which is the default action.
To define your own action, you can use the CloseCaption
property and access the click event as described in the following code:
5. HoverColor
This property gets or sets the back color of the close button whenever the mouse hovers over the close box. It accepts the use of both the HEX and RGB color formats.
6. Icon
This property gets or sets the image that will be used as the graphical representation for the close box. A suitable icon would be the X sign. To specify an image for the close box, click on the ellipsis button located on the value of this property, which will bring up an options dialog box where you can select the desired image.
7. IconAlt
This property gets or sets an alternative image of the current icon to be used as the alternative representation for the close box. The current window state will show the image set on the Icon property and another window state would show the alternate icon set in this IconAlt
property.
This property is not suitable for the Close button. However, for your creativity you can specify an alternative icon other than the default X symbol for the close button.
8. IconColor
This property gets or sets the color of the icon set on the close box. It accepts the use of both the HEX and RGB color formats.
9. IconHoverColor
This property gets or sets the color of the icon set on the close box whenever the mouse hovers on the close box. It accepts the use of both the HEX and RGB color formats.
10.IconPressedColor
This property gets or sets the color of the icon set on the close box whenever the user clicks on the close box. It accepts the use of both the HEX and RGB color formats.
11.IconSize
This property gets or sets both the height and width of the icon set on the close box. The default value is 14 for both the height and width properties.
12.PressedColor
This property gets or sets the back color on the close box whenever the user clicks on the close box. It accepts the use of both the HEX and RGB color formats.
The Help button is the one on the first controls on the box. Clicking the Help button runs a process that can open a link to a browser or other window with your help resources. By default, the Help Button is not shown. Set the HelpBox property to true to display a Help button in the form's caption bar. Below you can find the options of the Help button:
1. BackColor
This property gets or sets the background color of the help button. It accepts the use of both the HEX and RGB color formats.
2. BorderRadius
This property gets or sets a radius value (integer) that determines the roundness of the help button edges. The greater the value, the more rounded the border corners become.
3. Enabled
This property gets or sets a boolean value that determines whether the help button performs an action on the Windows form when you click it. A false value prevents the help button from performing its action on the Windows form, while a true value allows the button to execute an action on the form (e.g., open a link to a browser ).
You can define an action by describing it in the helpCaption
click event as in the following example:-
5. HoverColor
This property gets or sets the back color of the help button whenever the mouse hovers over the help box. It accepts the use of both the HEX and RGB color formats.
6. Icon
This property gets or sets the image that will be used as the icon vector for the help box. A suitable icon would be the a question mark symbol sign. To specify an image for the help box, click on the ellipsis button located on the value of this property, which will bring up an options dialog box where you can select the desired image.
7. IconAlt
This property gets or sets an alternative image of the current icon to be used as the alternative representation for the help caption.
8. IconColor
This property gets or sets the color of the icon set on the help box. It accepts the use of both the HEX and RGB color formats.
9. IconHoverColor
This property gets or sets the color of the icon set on the help box whenever the mouse hovers on the help box. It accepts the use of both the HEX and RGB color formats.
10.IconPressedColor
This property gets or sets the color of the icon set on the help caption whenever the user clicks on the help caption. It accepts the use of both the HEX and RGB color formats.
11.IconSize
This property gets or sets both the height and width of the icon set on the help caption. The default value is 14 for both the height and width properties.
12.PressedColor
This property gets or sets the back color on the help caption whenever the user clicks on the help caption. It accepts the use of both the HEX and RGB color formats.
13.HelpBox
This property gets or sets a boolean value that determines if the help button is visible. A false value hides the help button whereas a true one shows the help button.