Bunifu Shapes
Create Stylish shapes with intuitive customization options and design features
Last updated
Create Stylish shapes with intuitive customization options and design features
Last updated
Bunifu Shapes is a great control for applying a geometrical set of items in our Win-Forms applications, thus creating a winning and presentable user interfaces, that effectively engage the users of your application.
Let’s first take a look at the shapes rendered by the control in the figure below.
Bunifu Shapes can be added to the Form by dragging it from the toolbox as shown from the following visual. Once dropped in the form, the shape control will be preset with a circle shape.
Let's dive deep into the properties of this control and draw ideas of how we’ll use them to create awesome user interfaces.
Bunifu Shapes gives us more control as developers to set our own preferences for the shapes and bring out the full potential of creativeness. The following figure summarizes the commonly used properties t create custom displays for the shapes i.e.: BorderColor
, BackgroundColor
, Size
and ShapeType
BorderColor
property The BorderColor
property allows us to get the current color or set a new color value to the shape.
BorderThickness
property The BorderThickness
property allows us to get the current value or set a new integral value to the border thickness of the shape.
The FillColor
property enables us to apply a background color for the shape. It allows us to get the current color value or set a new color to the shape.
The default height
and width
of the shape can be changed by accessing the Size
property or adjust the Height
or Width
properties individually in the properties pane.
The preset shape can be changed using the Shape
property. It also allows us also to get the current value of the shape. The current shape can be changed to either a circle, a square, a polygon, an oval, or a line shape.
The number of sides of the polygon helps us to define the type of polygon we would love to have in our user interface. The default value can be changed using the Sides
property. Just like the other properties, we can get the current value of the number of sides. The figure below shows the number of sides set to 8 defining an octagonal shape during the design mode.
The Angle
property allows us to set a new angle value or get the current integral value of the shape. Changing the current value renders a new viewpoint of the shape on the same axis. The Values of the angle can be set to a maximum value of 360 and a minimum value of 0. Negative values can also be assigned to the Angle property having values ranging from -0 to -360 hence having the shape move in an anticlockwise direction. The figure below shows the angle set to a value 72 thus the triangle shape moves 72 degrees clockwise in the same axis.
From the properties discussed above, let’s utilize the properties to create something entertaining! The figure below is a sample Win-Forms application that utilizes Bunifu Shape control and using the Timer control of the Win-Forms and a Bunifu Slider to increase or decrease the speed of the rotating shape animation. Let’s have a glance of the visual below
The code below helps us to achieve the above animation
The ShapeChanged
event is useful in situations where we want to make our code more extensible, and have an easy coding experience when dealing with one control, that can render different shapes. Imagine, we want to have the line shape assigned with a different FillColor
value, while the other shapes are assigned a transparent value to the FillColor
property.
Or suppose we want to assign a different color for the BorderColor
property on different shapes with the same one control! Isn’t that exciting?
Using the ShapeChanged
event it is possible to implement these kinds of use-cases. Other use cases of your choice, comparable to the ones we’ve mentioned, can be applied to this event. The ShapeChanged
event can be accessed in the events property pane of your Visual Studio.
The example below illustrates the use cases mentioned:
The code below helps us achieve the functionalities shown from the above visual
Bunifu Shapes lends us a basis and a framework for creativity in relation to physical objects and being physical beings, we automatically relate to shapes; we subconsciously connect them to physical objects. This can in turn influence how we feel about an idea hence integrating ith in our Win-Forms application