Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ' ***********************************************************************
- ' Author : Elektro
- ' Modified : 21-November-2015
- ' ***********************************************************************
- #Region " Public Members Summary "
- #Region " Constructors "
- ' ControlDragInfo.New(Control)
- #End Region
- #Region " Methods "
- ' ControlDragInfo.Form As Control
- ' ControlDragInfo.Name As String
- ' ControlDragInfo.Enabled As Boolean
- ' ControlDragInfo.Cursor As Cursor
- ' ControlDragInfo.CursorNormal As Cursor
- ' ControlDragInfo.DragInfo As ControlDragger
- #End Region
- #End Region
- #Region " Option Statements "
- Option Explicit On
- Option Strict On
- Option Infer Off
- #End Region
- #Region " Imports "
- Imports System.ComponentModel
- Imports System.Drawing
- Imports System.Windows.Forms
- Imports System.Xml.Serialization
- Imports Elektro.Core.Types
- #End Region
- #Region " Control-Drag Info "
- Namespace UI.Types
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Defines the draggable info of a <see cref="ControlDragger"/>.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- <Serializable>
- <XmlRoot("DragInfo")>
- Public NotInheritable Class ControlDragInfo : Inherits AestheticObject
- #Region " Properties "
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Gets the owner <see cref="Control"/> that is used to perform draggable operations.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <value>
- ''' The owner <see cref="Control"/> that is used to perform draggable operations.
- ''' </value>
- ''' ----------------------------------------------------------------------------------------------------
- Public ReadOnly Property Control As Control
- Get
- Return Me.controlB
- End Get
- End Property
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' ( Backing field )
- ''' The owner <see cref="Control"/> that is used to perform draggable operations.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- <NonSerialized>
- Private ReadOnly controlB As Control
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Gets the name of the owner <see cref="Control"/>.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <value>
- ''' The name of the owner <see cref="Control"/>.
- ''' </value>
- ''' ----------------------------------------------------------------------------------------------------
- Public ReadOnly Property Name As String
- Get
- If (Me.controlB IsNot Nothing) Then
- Return Me.controlB.Name
- Else
- Return String.Empty
- End If
- End Get
- End Property
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Gets or sets a value indicating whether drag is enabled on the owner <see cref="Control"/>.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <value>
- ''' <see langword="True"/> if drag is enabled; otherwise, <see langword="False"/>.
- ''' </value>
- ''' ----------------------------------------------------------------------------------------------------
- Public Property Enabled As Boolean
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Gets or sets the <see cref="ControlDragger"/> instance of the owner <see cref="Control"/>.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <value>
- ''' The <see cref="ControlDragger"/> instance of the owner <see cref="Control"/>.
- ''' </value>
- ''' ----------------------------------------------------------------------------------------------------
- <EditorBrowsable(EditorBrowsableState.Never)>
- Public Property DragInfo As ControlDragger = ControlDragger.Empty
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Gets or sets the <see cref="Cursor"/> of the owner <see cref="Control"/> to use when dragging it.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <value>
- ''' The <see cref="Cursor"/> of the owner <see cref="Control"/> to use when dragging it.
- ''' </value>
- ''' ----------------------------------------------------------------------------------------------------
- Public Property Cursor As Cursor = Cursors.SizeAll
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Gets or sets the <see cref="Cursor"/> of the owner <see cref="Control"/> to use when not dragging it.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <value>
- ''' The <see cref="Cursor"/> of the owner <see cref="Control"/> to use when not dragging it.
- ''' </value>
- ''' ----------------------------------------------------------------------------------------------------
- <EditorBrowsable(EditorBrowsableState.Never)>
- Public Property CursorNormal As Cursor = Nothing
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Gets or sets the initial mouse coordinates, normally <see cref="Control.MousePosition"/>.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <value>
- ''' The initial mouse coordinates, normally <see cref="Control.MousePosition"/>.
- ''' </value>
- ''' ----------------------------------------------------------------------------------------------------
- <EditorBrowsable(EditorBrowsableState.Never)>
- Public Property InitialMouseCoords As Point = Point.Empty
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Gets or sets the initial <see cref="Control"/> location, normally <see cref="Control.Location"/>.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <value>
- ''' The initial <see cref="Control"/> location, normally <see cref="Control.Location"/>.
- ''' </value>
- ''' ----------------------------------------------------------------------------------------------------
- <EditorBrowsable(EditorBrowsableState.Never)>
- Public Property InitialLocation As Point = Point.Empty
- #End Region
- #Region " Constructors "
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Prevents a default instance of the <see cref="ControlDragInfo"/> class from being created.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerNonUserCode>
- Private Sub New()
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Initializes a new instance of the <see cref="ControlDragInfo"/> class.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="ctrl">
- ''' The owner <see cref="Control"/>.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Sub New(ByVal ctrl As Control)
- Me.controlB = ctrl
- Me.Cursor = ctrl.Cursor
- End Sub
- #End Region
- End Class
- End Namespace
- #End Region
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement