How to Move and Resize a Form Without a Border

How to move and resize a form without a border?

Some sample code that allow moving and resizing the form:

  public partial class Form1 : Form {
public Form1() {
InitializeComponent();
this.FormBorderStyle = FormBorderStyle.None;
this.DoubleBuffered = true;
this.SetStyle(ControlStyles.ResizeRedraw, true);
}
private const int cGrip = 16; // Grip size
private const int cCaption = 32; // Caption bar height;

protected override void OnPaint(PaintEventArgs e) {
Rectangle rc = new Rectangle(this.ClientSize.Width - cGrip, this.ClientSize.Height - cGrip, cGrip, cGrip);
ControlPaint.DrawSizeGrip(e.Graphics, this.BackColor, rc);
rc = new Rectangle(0, 0, this.ClientSize.Width, cCaption);
e.Graphics.FillRectangle(Brushes.DarkBlue, rc);
}

protected override void WndProc(ref Message m) {
if (m.Msg == 0x84) { // Trap WM_NCHITTEST
Point pos = new Point(m.LParam.ToInt32());
pos = this.PointToClient(pos);
if (pos.Y < cCaption) {
m.Result = (IntPtr)2; // HTCAPTION
return;
}
if (pos.X >= this.ClientSize.Width - cGrip && pos.Y >= this.ClientSize.Height - cGrip) {
m.Result = (IntPtr)17; // HTBOTTOMRIGHT
return;
}
}
base.WndProc(ref m);
}
}

How to resize borderless form from all edges

Here you go, a copy of the 2nd answer from the below link. Translate it if you need to.

How to move and resize a form without a border?

VB Code

Public Class Form2
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.FormBorderStyle = FormBorderStyle.None
Me.DoubleBuffered = True
Me.SetStyle(ControlStyles.ResizeRedraw, True)
End Sub

Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
e.Graphics.FillRectangle(Brushes.Green, Top)
e.Graphics.FillRectangle(Brushes.Green, Left)
e.Graphics.FillRectangle(Brushes.Green, Right)
e.Graphics.FillRectangle(Brushes.Green, Bottom)
End Sub


Private Const HTLEFT As Integer = 10, HTRIGHT As Integer = 11, HTTOP As Integer = 12, HTTOPLEFT As Integer = 13, HTTOPRIGHT As Integer = 14, HTBOTTOM As Integer = 15, HTBOTTOMLEFT As Integer = 16, HTBOTTOMRIGHT As Integer = 17

Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
MyBase.WndProc(m)
If m.Msg = &H84 Then
Dim mp = Me.PointToClient(Cursor.Position)

If TopLeft.Contains(mp) Then
m.Result = CType(HTTOPLEFT, IntPtr)
ElseIf TopRight.Contains(mp) Then
m.Result = CType(HTTOPRIGHT, IntPtr)
ElseIf BottomLeft.Contains(mp) Then
m.Result = CType(HTBOTTOMLEFT, IntPtr)
ElseIf BottomRight.Contains(mp) Then
m.Result = CType(HTBOTTOMRIGHT, IntPtr)
ElseIf Top.Contains(mp) Then
m.Result = CType(HTTOP, IntPtr)
ElseIf Left.Contains(mp) Then
m.Result = CType(HTLEFT, IntPtr)
ElseIf Right.Contains(mp) Then
m.Result = CType(HTRIGHT, IntPtr)
ElseIf Bottom.Contains(mp) Then
m.Result = CType(HTBOTTOM, IntPtr)
End If
End If
End Sub

Dim rng As New Random
Function randomColour() As Color
Return Color.FromArgb(255, rng.Next(255), rng.Next(255), rng.Next(255))
End Function

Const ImaginaryBorderSize As Integer = 16

Function Top() As Rectangle
Return New Rectangle(0, 0, Me.ClientSize.Width, ImaginaryBorderSize)
End Function

Function Left() As Rectangle
Return New Rectangle(0, 0, ImaginaryBorderSize, Me.ClientSize.Height)
End Function

Function Bottom() As Rectangle
Return New Rectangle(0, Me.ClientSize.Height - ImaginaryBorderSize, Me.ClientSize.Width, ImaginaryBorderSize)
End Function

Function Right() As Rectangle
Return New Rectangle(Me.ClientSize.Width - ImaginaryBorderSize, 0, ImaginaryBorderSize, Me.ClientSize.Height)
End Function

Function TopLeft() As Rectangle
Return New Rectangle(0, 0, ImaginaryBorderSize, ImaginaryBorderSize)
End Function

Function TopRight() As Rectangle
Return New Rectangle(Me.ClientSize.Width - ImaginaryBorderSize, 0, ImaginaryBorderSize, ImaginaryBorderSize)
End Function

Function BottomLeft() As Rectangle
Return New Rectangle(0, Me.ClientSize.Height - ImaginaryBorderSize, ImaginaryBorderSize, ImaginaryBorderSize)
End Function

Function BottomRight() As Rectangle
Return New Rectangle(Me.ClientSize.Width - ImaginaryBorderSize, Me.ClientSize.Height - ImaginaryBorderSize, ImaginaryBorderSize, ImaginaryBorderSize)
End Function

End Class

C# Code

public Form1()
{
InitializeComponent();

this.DoubleBuffered = true;
this.SetStyle(ControlStyles.ResizeRedraw, true);
}

protected override void OnPaint(PaintEventArgs e)
{
e.Graphics.FillRectangle(Brushes.Transparent, Top());
e.Graphics.FillRectangle(Brushes.Transparent, Left());
e.Graphics.FillRectangle(Brushes.Transparent, Right());
e.Graphics.FillRectangle(Brushes.Transparent, Bottom());
}

private const int HTLEFT = 10;
private const int HTRIGHT = 11;
private const int HTTOP = 12;
private const int HTTOPLEFT = 13;
private const int HTTOPRIGHT = 14;
private const int HTBOTTOM = 15;
private const int HTBOTTOMLEFT = 16;
private const int HTBOTTOMRIGHT = 17;

protected override void WndProc(ref System.Windows.Forms.Message m)
{
base.WndProc(ref m);
if (m.Msg == 0x84)
{
var mp = this.PointToClient(Cursor.Position);

if (TopLeft().Contains(mp))
m.Result = (IntPtr)HTTOPLEFT;
else if (TopRight().Contains(mp))
m.Result = (IntPtr)HTTOPRIGHT;
else if (BottomLeft().Contains(mp))
m.Result = (IntPtr)HTBOTTOMLEFT;
else if (BottomRight().Contains(mp))
m.Result = (IntPtr)HTBOTTOMRIGHT;
else if (Top().Contains(mp))
m.Result = (IntPtr)HTTOP;
else if (Left().Contains(mp))
m.Result = (IntPtr)HTLEFT;
else if (Right().Contains(mp))
m.Result = (IntPtr)HTRIGHT;
else if (Bottom().Contains(mp))
m.Result = (IntPtr)HTBOTTOM;
}
}

private Random rng = new Random();
public Color randomColour()
{
return Color.FromArgb(255, rng.Next(255), rng.Next(255), rng.Next(255));
}

const int ImaginaryBorderSize = 2;

public new Rectangle Top()
{
return new Rectangle(0, 0, this.ClientSize.Width, ImaginaryBorderSize);
}

public new Rectangle Left()
{
return new Rectangle(0, 0, ImaginaryBorderSize, this.ClientSize.Height);
}

public new Rectangle Bottom()
{
return new Rectangle(0, this.ClientSize.Height - ImaginaryBorderSize, this.ClientSize.Width, ImaginaryBorderSize);
}

public new Rectangle Right()
{
return new Rectangle(this.ClientSize.Width - ImaginaryBorderSize, 0, ImaginaryBorderSize, this.ClientSize.Height);
}

public Rectangle TopLeft()
{
return new Rectangle(0, 0, ImaginaryBorderSize, ImaginaryBorderSize);
}

public Rectangle TopRight()
{
return new Rectangle(this.ClientSize.Width - ImaginaryBorderSize, 0, ImaginaryBorderSize, ImaginaryBorderSize);
}

public Rectangle BottomLeft()
{
return new Rectangle(0, this.ClientSize.Height - ImaginaryBorderSize, ImaginaryBorderSize, ImaginaryBorderSize);
}

public Rectangle BottomRight()
{
return new Rectangle(this.ClientSize.Width - ImaginaryBorderSize, this.ClientSize.Height - ImaginaryBorderSize, ImaginaryBorderSize, ImaginaryBorderSize);
}

Borderless and Resizable Form (C#)

Try this:

public Form1()
{
InitializeComponent();
this.FormBorderStyle = FormBorderStyle.None;
}

protected override void WndProc(ref Message m)
{
const int RESIZE_HANDLE_SIZE = 10;

switch (m.Msg)
{
case 0x0084/*NCHITTEST*/ :
base.WndProc(ref m);

if ((int)m.Result == 0x01/*HTCLIENT*/)
{
Point screenPoint = new Point(m.LParam.ToInt32());
Point clientPoint = this.PointToClient(screenPoint);
if (clientPoint.Y <= RESIZE_HANDLE_SIZE)
{
if (clientPoint.X <= RESIZE_HANDLE_SIZE)
m.Result = (IntPtr) 13/*HTTOPLEFT*/ ;
else if (clientPoint.X < (Size.Width - RESIZE_HANDLE_SIZE))
m.Result = (IntPtr) 12/*HTTOP*/ ;
else
m.Result = (IntPtr) 14/*HTTOPRIGHT*/ ;
}
else if (clientPoint.Y <= (Size.Height - RESIZE_HANDLE_SIZE))
{
if (clientPoint.X <= RESIZE_HANDLE_SIZE)
m.Result = (IntPtr) 10/*HTLEFT*/ ;
else if (clientPoint.X < (Size.Width - RESIZE_HANDLE_SIZE))
m.Result = (IntPtr) 2/*HTCAPTION*/ ;
else
m.Result = (IntPtr) 11/*HTRIGHT*/ ;
}
else
{
if (clientPoint.X <= RESIZE_HANDLE_SIZE)
m.Result = (IntPtr) 16/*HTBOTTOMLEFT*/ ;
else if (clientPoint.X < (Size.Width - RESIZE_HANDLE_SIZE))
m.Result = (IntPtr) 15/*HTBOTTOM*/ ;
else
m.Result = (IntPtr)17/*HTBOTTOMRIGHT*/ ;
}
}
return;
}
base.WndProc(ref m);
}

protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.Style |= 0x20000; // <--- use 0x20000
return cp;
}
}

informational sources:

  • https://stackoverflow.com/a/19670447/2352507
  • Custom Resize Handle in Border-less Form C#
  • http://www.csharp411.com/add-drop-shadow-to-borderless-form/

Resize a borderless form that has controls everywhere, no empty space

It can be done in different ways. The main idea in this answer is putting a panel on form as content container, then exclude bottom right region of it (size grip rectangle) so this region is not belogns to panel anymore and all mouse events of that rectangle will be routed to form, and even panel doesn't draw that region.

To achieve that, do the following steps:

  1. Crate Form and set BorderStyle property to None

  2. Add a Panel to Form as content holder and set its Name to panel1 and set the Dock property of panel to Fill

  3. Override OnSizeChanged of form and set the region of panel same size as form and then exclude its bottom right corner. This way, the excluded region doesn't belong to panel anymore and all messages including WM_NCHITTEST will be received by our WndProc; the panel even doesn't draw that region.

  4. Override WndProc to get WM_NCHITTEST message and if the point is in the region that we defined in OnSizeChanges, the show resize pointer and prepare to resize.

  5. Override OnPaint to draw size grip

Screenshot:

Sample Image

and here is the form with some controls in container panel of it:

Sample Image

If you move your mouse over size grip, you will see your mouse pointer changes to Bottom Right Size Pointer and you can resize your form using it.

You can set MinimumSize ad MaximumSize of the form to prevent ugly too small or too large form.

Code:

Here is complete code:

private int tolerance = 16;
private const int WM_NCHITTEST = 132;
private const int HTBOTTOMRIGHT = 17;
private Rectangle sizeGripRectangle;

protected override void WndProc(ref Message m)
{
switch (m.Msg)
{
case WM_NCHITTEST:
base.WndProc(ref m);
var hitPoint = this.PointToClient(new Point(m.LParam.ToInt32() & 0xffff, m.LParam.ToInt32() >> 16));
if (sizeGripRectangle.Contains(hitPoint))
m.Result = new IntPtr(HTBOTTOMRIGHT);
break;
default:
base.WndProc(ref m);
break;
}
}

protected override void OnSizeChanged(EventArgs e)
{
base.OnSizeChanged(e);
var region = new Region(new Rectangle(0, 0, this.ClientRectangle.Width, this.ClientRectangle.Height));
sizeGripRectangle = new Rectangle(this.ClientRectangle.Width - tolerance, this.ClientRectangle.Height - tolerance, tolerance, tolerance);
region.Exclude(sizeGripRectangle);
this.panel1.Region = region;
this.Invalidate();
}

protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
ControlPaint.DrawSizeGrip(e.Graphics, Color.Transparent, sizeGripRectangle);
}

Preventing a custom border resize handle from resizing a winform too small

Regardless of the Form being borderless or not, you can still use the MinimumSize and MaximumSize properties.

Try this:

public Form1()
{
InitializeComponent();
this.DoubleBuffered = true;
this.SetStyle(ControlStyles.ResizeRedraw, true);

this.MinimumSize = new Size(200, 200);
this.MaximumSize = new Size(800, 600);
}

How can I drag borderless form on all it's area ? How to resize borderless form?

I have created a fairly simple class for you that will do everything you need. You can create shortcut keys, resize the form even if it does not have a border, and you can move it by clicking and dragging on any point inside the form. Hope this helps, I did my best to explain the code in the comments. If you need any more clarification just let me know!

CustomForm.cs:

public class CustomForm : Form
{
/// <summary>
/// How close your cursor must be to any of the sides/corners of the form to be able to resize
/// </summary>
public int GrabSize = 8;

/// <summary>
/// The shortcut keys for this form
/// </summary>
public Dictionary<Keys, Action> ShortcutKeys = new Dictionary<Keys, Action>();

private bool Drag = false;
private Point DragOrigin;
private const int HT_LEFT = 10;
private const int HT_RIGHT = 11;
private const int HT_TOP = 12;
private const int HT_BOTTOM = 15;
private const int HT_TOPLEFT = 13;
private const int HT_TOPRIGHT = 14;
private const int HT_BOTTOMLEFT = 16;
private const int HT_BOTTOMRIGHT = 17;

protected override void OnMouseDown(MouseEventArgs e)
{
base.OnMouseDown(e);

// If hold left click on the form, then start the dragging operation
if (e.Button == MouseButtons.Left)
{
// Only start dragging operation if cursor position is NOT within the resize regions
if (e.X > GrabSize && e.X < Width - GrabSize && e.Y > GrabSize && e.Y < Height - GrabSize)
{
DragOrigin = e.Location;
Drag = true;
}
}
}

protected override void OnMouseUp(MouseEventArgs e)
{
base.OnMouseUp(e);

// If let go of left click while dragging the form, then stop the dragging operation
if (e.Button == MouseButtons.Left && Drag)
Drag = false;
}

protected override void OnMouseMove(MouseEventArgs e)
{
base.OnMouseMove(e);

// Move the form location based on where the cursor has moved relative to where the cursor position was when we first started the dragging operation
if (Drag)
Location = new Point(Location.X + (e.Location.X - DragOrigin.X), Location.Y + (e.Location.Y - DragOrigin.Y));
}

/// <summary>
/// Invokes any shortcut keys that have been added to this form
/// </summary>
protected override bool ProcessCmdKey(ref Message msg, Keys key)
{
Action action;
if(ShortcutKeys.TryGetValue(key, out action))
{
action.Invoke();
return true;
}
return base.ProcessCmdKey(ref msg, key);
}

/// <summary>
/// Handles resizing of a borderless control/winform
/// </summary>
protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
if(FormBorderStyle == FormBorderStyle.None && m.Msg == 0x84)
{
Point CursorLocation = PointToClient(new Point(m.LParam.ToInt32()));
if (CursorLocation.X <= GrabSize)
{
if (CursorLocation.Y <= GrabSize) // TOP LEFT
m.Result = new IntPtr(HT_TOPLEFT);
else if (CursorLocation.Y >= ClientSize.Height - GrabSize) // BOTTOM LEFT
m.Result = new IntPtr(HT_BOTTOMLEFT);
else
m.Result = new IntPtr(HT_LEFT); // RESIZE LEFT
}
else if (CursorLocation.X >= ClientSize.Width - GrabSize)
{
if (CursorLocation.Y <= GrabSize)
m.Result = new IntPtr(HT_TOPRIGHT); // RESIZE TOP RIGHT
else if (CursorLocation.Y >= ClientSize.Height - GrabSize)
m.Result = new IntPtr(HT_BOTTOMRIGHT); // RESIZE BOTTOM RIGHT
else
m.Result = new IntPtr(HT_RIGHT); // RESIZE RIGHT
}
else if (CursorLocation.Y <= GrabSize)
m.Result = new IntPtr(HT_TOP); // RESIZE TOP
else if (CursorLocation.Y >= ClientSize.Height - GrabSize)
m.Result = new IntPtr(HT_BOTTOM); // RESIZE BOTTOM
}
}
}

To use this class, simply make your forms inherit from CustomForm rather then Form.
You can add shortcut keys to the form by adding to the CustomForm's shortcut key dictionary like so: ShortcutKeys.Add(key, action); where key is a System.Windows.Forms.Keys, and action is an Action Delegate.

In your case, your code would look something similar to:

public partial class Form1 : CustomForm
{
SolidBrush mybrush;
private const int cGrip = 16; // Grip size
private const int cCaption = 32; // Caption bar height

public Form1()
{
InitializeComponent();

mybrush = new SolidBrush(this.BackColor);

// Adds a new shortcut key that will invoke CreateNewForm every time Ctrl+F is pressed
ShortcutKeys.Add(Keys.Control | Keys.F, CreateNewForm);

this.FormBorderStyle = FormBorderStyle.None;
this.DoubleBuffered = true;
this.SetStyle(ControlStyles.ResizeRedraw, true);
}

protected override void OnPaint(PaintEventArgs e)
{
Rectangle rc = new Rectangle(this.ClientSize.Width - cGrip, this.ClientSize.Height - cGrip, cGrip, cGrip);
ControlPaint.DrawSizeGrip(e.Graphics, this.BackColor, rc);
rc = new Rectangle(0, 0, this.ClientSize.Width, cCaption);
e.Graphics.FillRectangle(mybrush, rc);
}

private void Form1_Load(object sender, EventArgs e)
{

}

private void Form1_Paint(object sender, PaintEventArgs e)
{

}

/// <summary>
/// Create a new instance of this form
/// </summary>
private void CreateNewForm()
{
new Form1().Show();
}
}

How to move form without form border (visual studio)

Simple as this, add this code to your Form-Class:

#Region " Move Form "

' [ Move Form ]
'
' // By Elektro

Public MoveForm As Boolean
Public MoveForm_MousePosition As Point

Public Sub MoveForm_MouseDown(sender As Object, e As MouseEventArgs) Handles _
MyBase.MouseDown ' Add more handles here (Example: PictureBox1.MouseDown)

If e.Button = MouseButtons.Left Then
MoveForm = True
Me.Cursor = Cursors.NoMove2D
MoveForm_MousePosition = e.Location
End If

End Sub

Public Sub MoveForm_MouseMove(sender As Object, e As MouseEventArgs) Handles _
MyBase.MouseMove ' Add more handles here (Example: PictureBox1.MouseMove)

If MoveForm Then
Me.Location = Me.Location + (e.Location - MoveForm_MousePosition)
End If

End Sub

Public Sub MoveForm_MouseUp(sender As Object, e As MouseEventArgs) Handles _
MyBase.MouseUp ' Add more handles here (Example: PictureBox1.MouseUp)

If e.Button = MouseButtons.Left Then
MoveForm = False
Me.Cursor = Cursors.Default
End If

End Sub

#End Region

Here is an updated version:

' ***********************************************************************
' Author : Elektro
' Modified : 15-March-2015
' ***********************************************************************
' <copyright file="FormDragger.vb" company="Elektro Studios">
' Copyright (c) Elektro Studios. All rights reserved.
' </copyright>
' ***********************************************************************

#Region " Option Statements "

Option Explicit On
Option Strict On
Option Infer Off

#End Region

#Region " Usage Examples "

'Public Class Form1

' ''' <summary>
' ''' The <see cref="FormDragger"/> instance that manages the form(s) dragging.
' ''' </summary>
' Private formDragger As FormDragger = FormDragger.Empty

' Private Sub Test() Handles MyBase.Shown
' Me.InitializeDrag()
' End Sub

' Private Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) _
' Handles Button1.Click

' Me.AlternateDragEnabled(Me)

' End Sub

' Private Sub InitializeDrag()

' ' 1st way, using the single-Form constructor:
' Me.formDragger = New FormDragger(Me, enabled:=True, cursor:=Cursors.SizeAll)

' ' 2nd way, using the multiple-Forms constructor:
' ' Me.formDragger = New FormDragger({Me, Form2, form3})

' ' 3rd way, using the default constructor then adding a Form into the collection:
' ' Me.formDragger = New FormDragger
' ' Me.formDragger.AddForm(Me, enabled:=True, cursor:=Cursors.SizeAll)

' End Sub

' ''' <summary>
' ''' Alternates the dragging of the specified form.
' ''' </summary>
' ''' <param name="form">The form.</param>
' Private Sub AlternateDragEnabled(ByVal form As Form)

' Dim formInfo As FormDragger.FormDragInfo = Me.formDragger.FindFormDragInfo(form)
' formInfo.Enabled = Not formInfo.Enabled

' End Sub

'End Class

#End Region

#Region " Imports "

Imports System.ComponentModel

#End Region

#Region " Form Dragger "

''' <summary>
''' Enable or disable drag at runtime on a <see cref="Form"/>.
''' </summary>
Public NotInheritable Class FormDragger : Implements IDisposable

#Region " Properties "

''' <summary>
''' Gets an <see cref="IEnumerable(Of Form)"/> collection that contains the Forms capables to perform draggable operations.
''' </summary>
''' <value>The <see cref="IEnumerable(Of Form)"/>.</value>
<EditorBrowsable(EditorBrowsableState.Always)>
Public ReadOnly Property Forms As IEnumerable(Of FormDragInfo)
Get
Return Me.forms1
End Get
End Property
''' <summary>
''' An <see cref="IEnumerable(Of Form)"/> collection that contains the Forms capables to perform draggable operations.
''' </summary>
Private forms1 As IEnumerable(Of FormDragInfo) = {}

''' <summary>
''' Represents a <see cref="FormDragger"/> instance that is <c>Nothing</c>.
''' </summary>
''' <value><c>Nothing</c></value>
<EditorBrowsable(EditorBrowsableState.Always)>
Public Shared ReadOnly Property Empty As FormDragger
Get
Return Nothing
End Get
End Property

#End Region

#Region " Types "

''' <summary>
''' Defines the draggable info of a <see cref="Form"/>.
''' </summary>
<Serializable>
Public NotInheritable Class FormDragInfo

#Region " Properties "

''' <summary>
''' Gets the associated <see cref="Form"/> used to perform draggable operations.
''' </summary>
''' <value>The associated <see cref="Form"/>.</value>
<EditorBrowsable(EditorBrowsableState.Always)>
Public ReadOnly Property Form As Form
Get
Return form1
End Get
End Property
''' <summary>
''' The associated <see cref="Form"/>
''' </summary>
<NonSerialized>
Private ReadOnly form1 As Form

''' <summary>
''' Gets the name of the associated <see cref="Form"/>.
''' </summary>
''' <value>The Form.</value>
<EditorBrowsable(EditorBrowsableState.Always)>
Public ReadOnly Property Name As String
Get
If Me.Form IsNot Nothing Then
Return Form.Name
Else
Return String.Empty
End If
End Get
End Property

''' <summary>
''' Gets or sets a value indicating whether drag is enabled on the associated <see cref="Form"/>.
''' </summary>
''' <value><c>true</c> if drag is enabled; otherwise, <c>false</c>.</value>
<EditorBrowsable(EditorBrowsableState.Always)>
Public Property Enabled As Boolean

''' <summary>
''' A <see cref="FormDragger"/> instance instance containing the draggable information of the associated <see cref="Form"/>.
''' </summary>
''' <value>The draggable information.</value>
<EditorBrowsable(EditorBrowsableState.Never)>
Public Property DragInfo As FormDragger = FormDragger.Empty

''' <summary>
''' Gets or sets the <see cref="Cursor"/> used to drag the associated <see cref="Form"/>.
''' </summary>
''' <value>The <see cref="Cursor"/>.</value>
<EditorBrowsable(EditorBrowsableState.Always)>
Public Property Cursor As Cursor = Cursors.SizeAll

''' <summary>
''' Gets or sets the old form's cursor to restore it after dragging.
''' </summary>
''' <value>The old form's cursor.</value>
<EditorBrowsable(EditorBrowsableState.Never)>
Public Property OldCursor As Cursor = Nothing

''' <summary>
''' Gets or sets the initial mouse coordinates, normally <see cref="Form.MousePosition"/>.
''' </summary>
''' <value>The initial mouse coordinates.</value>
<EditorBrowsable(EditorBrowsableState.Never)>
Public Property InitialMouseCoords As Point = Point.Empty

''' <summary>
''' Gets or sets the initial <see cref="Form"/> location, normally <see cref="Form.Location"/>.
''' </summary>
''' <value>The initial location.</value>
<EditorBrowsable(EditorBrowsableState.Never)>
Public Property InitialLocation As Point = Point.Empty

#End Region

#Region " Constructors "

''' <summary>
''' Initializes a new instance of the <see cref="FormDragInfo"/> class.
''' </summary>
''' <param name="form">The form.</param>
Public Sub New(ByVal form As Form)
Me.form1 = form
Me.Cursor = form.Cursor
End Sub

''' <summary>
''' Prevents a default instance of the <see cref="FormDragInfo"/> class from being created.
''' </summary>
Private Sub New()
End Sub

#End Region

#Region " Hidden Methods "

''' <summary>
''' Serves as a hash function for a particular type.
''' </summary>
<EditorBrowsable(EditorBrowsableState.Never)>
Public Shadows Function GetHashCode() As Integer
Return MyBase.GetHashCode
End Function

''' <summary>
''' Gets the System.Type of the current instance.
''' </summary>
''' <returns>The exact runtime type of the current instance.</returns>
<EditorBrowsable(EditorBrowsableState.Never)>
Public Shadows Function [GetType]() As Type
Return MyBase.GetType
End Function

''' <summary>
''' Determines whether the specified System.Object instances are considered equal.
''' </summary>
<EditorBrowsable(EditorBrowsableState.Never)>
Public Shadows Function Equals(ByVal obj As Object) As Boolean
Return MyBase.Equals(obj)
End Function

''' <summary>
''' Determines whether the specified System.Object instances are the same instance.
''' </summary>
<EditorBrowsable(EditorBrowsableState.Never)>
Private Shadows Sub ReferenceEquals()
End Sub


Related Topics



Leave a reply



Submit