Bunifu Form Drag

Make form drag operations easier and in seconds with Bunifu Form Drag

Overview

Bunifu Form Drag is a component designed to bring you seamless integration of drag operations on borderless forms to some desired target on your windows screen. Here is an illustration of this component in action:

Getting started

Adding Bunifu Form Drag at Design Time

It is quite easy to add a Bunifu form drag at the designer level.

Step 1: First, make sure that the form is borderless. This can be done either by setting the FormBorderStyle property to none.

Step 2: Find Bunifu Form Drag in your toolbox and drag it onto your form as shown below:

Note that at this point the form is draggable.

Handling a Drag Operation with Title Bar.

Step 1: First, create a title bar. This can be done by placing a panel and docking it to the top area of the form as shown below. You can name it as pnlTop

Step 2: In the properties of the Bunifu Form Drag component go to the TitleBarOptions property and in the TitleBarControl property set it with the pnlTop control as its value.

Step 3: Finally run the application. You have now successfully added a drag operation for a non-borderless form:

Adding Bunifu Form Drag at Run Time

To add a Bunifu Form Drag on our form at run-time, use the Load event handler of your form to run the following code:

private void Form1_Load(object sender, EventArgs e)
{
    BunifuFormDrag bunifuFormDrag = new BunifuFormDrag();
    bunifuFormDrag.ContainerControl = this;
}

Let's take a deep dive and get insights into the available properties on Bunifu Form Drag.

Properties

Title Bar Properties

To initiate the drag interaction, this property enables you to select your desired form control (i.e., the title bar e.g, a panel) as an object to initiate a drag operation and apply Drag and Windows Form effects. It contains a list of interactivity options for control set as a title bar of a form.

1. (TitleBarControl)

This property allows you to get or set a control as the main drag control of a form (e.g., Panel, BunifuPanel, etc...) which will be used to move the form to the desired location on the screen. This control is "normally" docked/anchored on the top part of the Window Form.

2. DoubleClickToExpandWindow

This property enables you to maximize your Window Form by the operation of double-clicking the control set as a title bar / main-drag control.

3. Enabled

This property sets a Boolean value that determines whether a user can perform drag operations on a Windows Form using the title bar. A value of True enables drag operations using the control set as the title bar and a value of False disables the use of the title bar control for drag operations.

4. UseBackColor

This property gets or sets a Boolean value indicating whether during a docking operation the back colour will be used as a semi-transparent outline which shows where the window will be docked if you release the mouse button at that point.

Docking Properties

You can set/get the look and feel of the borderless form while docking (i.e., pinning it to the desired location). This could be accomplished by simply dragging the window title bar toward the desktop corners versus the sides. (N.B., the windows form could dock 1/2 or 1/4 size windows vertically or horizontally.

Here is the list of properties to checkout while setting the docking effects:

1. ShowDockingIndicatorsColor

This property sets and gets a boolean value which when set to true, will override the default windows docking colour and apply the custom colour set in the DockingIndicatorsColor property. (N.b., The indicator is an outline which shows where the window will be docked to).

2. DockingIndicatorsColor

This property allows you to get or set the docking indicator colour. It supports the use of HEX, RGB, and ARGB colour formats. (N.b., this only works when the ShowDockingIndicator is set to true.

3. DockingOptions

PropertyDescription

a) (DockAll)

This property sets a Boolean value which determines if the Windows Form can be docked to either side of the screen display.

b) DockBottomLeft

This property sets a Boolean value which determines if the Windows Form can be docked to the bottom left side of the screen display)

c) DockBottomRight

This property sets a Boolean value which determines if the Windows Form can be docked to the bottom right side of the screen display)

g) DockLeft

This property sets a Boolean value which determines if the Windows Form can be docked to the left side of the screen display)

h) DockRight

This property sets a Boolean value which determines if the Windows Form can be docked to the right side of the screen display)

i) DockTopLeft

This property sets a Boolean value which determines if the Windows Form can be docked to the top-left side of the screen display

j) DockTopRight

This property sets a Boolean value which determines if the Windows Form can be docked to the top-right side of the screen display

4. ShowCursorChange

This property gets or sets a boolean value which when set to true changes the cursor icon from a SizeAll cursor to a SizeNS cursor when about to dock the form. The default value is true

Drag Properties

You can set/get the look and feel of the borderless form while dragging the form to the desired location on the screen. Dragging involves the operation where:

  • Users acquire the title bar using the mouse on a mouse click

  • While keeping the title bar selected (i.e., by continuous pressure on the mouse button), the user then moves the pointing device to some desired target. This is the “drag” part of the operation.

  • Finally, the user deselects the title bar — by letting go of the mouse button. This is the “drop” step.

Here are the properties to check-out in the drag properties:

1. AllowOpacityChanges

This property gets or sets a boolean value which when set to true applies an opacity to the form while dragging the form to a desired area in the display. The opacity value is determined by the DragOpacity property.

2. DragOpacity

This property gets or sets a percentage value which determines the transparency rate of the form while dragging it to a particular location. The lower the percentage, the higher the transparency view of the form will be while on a drag operation.

Last updated