DragBar - kris701/NDX GitHub Wiki

Table of Content

Overview

Up to date as of version 1.0

The dragbar is the bar thats up in the top of the winforms, this bar have multiple settings, such as color, size, dragstyle, maximize settings and so on.

The dragbar settings

Setting Function
Color DragbarBackColor { get, set} Gets or sets the color of the dragbar
int DragbarHeight { get, set} Gets or sets the height of the dragbar
int DragBarInnerMargin { get, set} Gets or sets the inner margin for buttons and title
bool DoubleClickToMaximize { get, set} Gets or sets whether double clicking the dragbar maximizes the window.

Buttons and title

As a default, there can be three buttons and a title. These are the exit button, minimize button, maximize button and the title label. The buttons all have the following settings:

Setting Function
bool HasButton { get, set} A bool that gets or sets if the button is shown
Color BackColor { get, set} Gets or sets the backcolor of the button
Color ForeColor { get, set} Gets or sets the forecolor of the button
int Height { get, set} Gets or sets the height of the button
int Width { get, set} Gets or sets the width of the button
DragBarLocation ButtonPos { get, set} Gets or sets ButtonPos of the button (look further down to see what ButtonPos is)
int DockID { get, set} Gets or sets the ID for ButtonPos
Font Font { get, set} Gets or sets the font of the button

Where the label have:

Setting Function
bool HasLabel{ get, set} A bool that gets or sets if the label is shown
Color TextColor { get, set} Gets or sets the text color of the label
int Width { get, set} Gets or sets the width of the label
DragBarLocation ButtonPos { get, set} Gets or sets TitlePos of the label (look further down to see what TitlePos is)
int DockID { get, set} Gets or sets the ID for TitlePos
Font Font { get, set} Gets or sets the font of the label

ButtonPos / DragBarLocation

These are a propperty that defines where on the dragbar to put the button/label. It consist of a Left, Right and Center option. To that there is also a DockID for the button/label, which defines what button/label to go first and so on. That means that if you have all three buttons, where the exit button has the DockID set to 0, and set to sit on the left side, then the Exit button would be furthest to the left. The logic to set the location of the control in the dragbar is a public function, and can be accesed with: GetControlPos(DragBarLocation ControlPos, int DockID, int ControlWidth), if you would want to put something in the dragbar your self. The dragbar panel is also a public panel, that can be accesed normaly with the NDX class.

Drag style

Dragstyle Function
Normal Nothing special, just a normal drag animation.
Opacity When you hold the mouse down on the dragbar, the whole forms becomes partially invisible, the degree of invisability can be set with the public variable DragStyleOpacityFactor, wich is normally 0.75, which is 75% visable.