Advertisement
Guest User

ControlDragInfo.vb

a guest
Mar 29th, 2017
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 9.02 KB | None | 0 0
  1. ' ***********************************************************************
  2. ' Author   : Elektro
  3. ' Modified : 21-November-2015
  4. ' ***********************************************************************
  5.  
  6. #Region " Public Members Summary "
  7.  
  8. #Region " Constructors "
  9.  
  10. ' ControlDragInfo.New(Control)
  11.  
  12. #End Region
  13.  
  14. #Region " Methods "
  15.  
  16. ' ControlDragInfo.Form As Control
  17. ' ControlDragInfo.Name As String
  18. ' ControlDragInfo.Enabled As Boolean
  19. ' ControlDragInfo.Cursor As Cursor
  20. ' ControlDragInfo.CursorNormal As Cursor
  21. ' ControlDragInfo.DragInfo As ControlDragger
  22.  
  23. #End Region
  24.  
  25. #End Region
  26.  
  27. #Region " Option Statements "
  28.  
  29. Option Explicit On
  30. Option Strict On
  31. Option Infer Off
  32.  
  33. #End Region
  34.  
  35. #Region " Imports "
  36.  
  37. Imports System.ComponentModel
  38. Imports System.Drawing
  39. Imports System.Windows.Forms
  40. Imports System.Xml.Serialization
  41. Imports Elektro.Core.Types
  42.  
  43. #End Region
  44.  
  45. #Region " Control-Drag Info "
  46.  
  47. Namespace UI.Types
  48.  
  49.     ''' ----------------------------------------------------------------------------------------------------
  50.     ''' <summary>
  51.     ''' Defines the draggable info of a <see cref="ControlDragger"/>.
  52.     ''' </summary>
  53.     ''' ----------------------------------------------------------------------------------------------------
  54.     <Serializable>
  55.     <XmlRoot("DragInfo")>
  56.     Public NotInheritable Class ControlDragInfo : Inherits AestheticObject
  57.  
  58. #Region " Properties "
  59.  
  60.         ''' ----------------------------------------------------------------------------------------------------
  61.         ''' <summary>
  62.         ''' Gets the owner <see cref="Control"/> that is used to perform draggable operations.
  63.         ''' </summary>
  64.         ''' ----------------------------------------------------------------------------------------------------
  65.         ''' <value>
  66.         ''' The owner <see cref="Control"/> that is used to perform draggable operations.
  67.         ''' </value>
  68.         ''' ----------------------------------------------------------------------------------------------------
  69.         Public ReadOnly Property Control As Control
  70.             Get
  71.                 Return Me.controlB
  72.             End Get
  73.         End Property
  74.         ''' ----------------------------------------------------------------------------------------------------
  75.         ''' <summary>
  76.         ''' ( Backing field )
  77.         ''' The owner <see cref="Control"/> that is used to perform draggable operations.
  78.         ''' </summary>
  79.         ''' ----------------------------------------------------------------------------------------------------
  80.         <NonSerialized>
  81.         Private ReadOnly controlB As Control
  82.  
  83.         ''' ----------------------------------------------------------------------------------------------------
  84.         ''' <summary>
  85.         ''' Gets the name of the owner <see cref="Control"/>.
  86.         ''' </summary>
  87.         ''' ----------------------------------------------------------------------------------------------------
  88.         ''' <value>
  89.         ''' The name of the owner <see cref="Control"/>.
  90.         ''' </value>
  91.         ''' ----------------------------------------------------------------------------------------------------
  92.         Public ReadOnly Property Name As String
  93.             Get
  94.                 If (Me.controlB IsNot Nothing) Then
  95.                     Return Me.controlB.Name
  96.                 Else
  97.                     Return String.Empty
  98.                 End If
  99.             End Get
  100.         End Property
  101.  
  102.         ''' ----------------------------------------------------------------------------------------------------
  103.         ''' <summary>
  104.         ''' Gets or sets a value indicating whether drag is enabled on the owner <see cref="Control"/>.
  105.         ''' </summary>
  106.         ''' ----------------------------------------------------------------------------------------------------
  107.         ''' <value>
  108.         ''' <see langword="True"/> if drag is enabled; otherwise, <see langword="False"/>.
  109.         ''' </value>
  110.         ''' ----------------------------------------------------------------------------------------------------
  111.         Public Property Enabled As Boolean
  112.  
  113.         ''' ----------------------------------------------------------------------------------------------------
  114.         ''' <summary>
  115.         ''' Gets or sets the <see cref="ControlDragger"/> instance of the owner <see cref="Control"/>.
  116.         ''' </summary>
  117.         ''' ----------------------------------------------------------------------------------------------------
  118.         ''' <value>
  119.         ''' The <see cref="ControlDragger"/> instance of the owner <see cref="Control"/>.
  120.         ''' </value>
  121.         ''' ----------------------------------------------------------------------------------------------------
  122.         <EditorBrowsable(EditorBrowsableState.Never)>
  123.         Public Property DragInfo As ControlDragger = ControlDragger.Empty
  124.  
  125.         ''' ----------------------------------------------------------------------------------------------------
  126.         ''' <summary>
  127.         ''' Gets or sets the <see cref="Cursor"/> of the owner <see cref="Control"/> to use when dragging it.
  128.         ''' </summary>
  129.         ''' ----------------------------------------------------------------------------------------------------
  130.         ''' <value>
  131.         ''' The <see cref="Cursor"/> of the owner <see cref="Control"/> to use when dragging it.
  132.         ''' </value>
  133.         ''' ----------------------------------------------------------------------------------------------------
  134.         Public Property Cursor As Cursor = Cursors.SizeAll
  135.  
  136.         ''' ----------------------------------------------------------------------------------------------------
  137.         ''' <summary>
  138.         ''' Gets or sets the <see cref="Cursor"/> of the owner <see cref="Control"/> to use when not dragging it.
  139.         ''' </summary>
  140.         ''' ----------------------------------------------------------------------------------------------------
  141.         ''' <value>
  142.         ''' The <see cref="Cursor"/> of the owner <see cref="Control"/> to use when not dragging it.
  143.         ''' </value>
  144.         ''' ----------------------------------------------------------------------------------------------------
  145.         <EditorBrowsable(EditorBrowsableState.Never)>
  146.         Public Property CursorNormal As Cursor = Nothing
  147.  
  148.         ''' ----------------------------------------------------------------------------------------------------
  149.         ''' <summary>
  150.         ''' Gets or sets the initial mouse coordinates, normally <see cref="Control.MousePosition"/>.
  151.         ''' </summary>
  152.         ''' ----------------------------------------------------------------------------------------------------
  153.         ''' <value>
  154.         ''' The initial mouse coordinates, normally <see cref="Control.MousePosition"/>.
  155.         ''' </value>
  156.         ''' ----------------------------------------------------------------------------------------------------
  157.         <EditorBrowsable(EditorBrowsableState.Never)>
  158.         Public Property InitialMouseCoords As Point = Point.Empty
  159.  
  160.         ''' ----------------------------------------------------------------------------------------------------
  161.         ''' <summary>
  162.         ''' Gets or sets the initial <see cref="Control"/> location, normally <see cref="Control.Location"/>.
  163.         ''' </summary>
  164.         ''' ----------------------------------------------------------------------------------------------------
  165.         ''' <value>
  166.         ''' The initial <see cref="Control"/> location, normally <see cref="Control.Location"/>.
  167.         ''' </value>
  168.         ''' ----------------------------------------------------------------------------------------------------
  169.         <EditorBrowsable(EditorBrowsableState.Never)>
  170.         Public Property InitialLocation As Point = Point.Empty
  171.  
  172. #End Region
  173.  
  174. #Region " Constructors "
  175.  
  176.         ''' ----------------------------------------------------------------------------------------------------
  177.         ''' <summary>
  178.         ''' Prevents a default instance of the <see cref="ControlDragInfo"/> class from being created.
  179.         ''' </summary>
  180.         ''' ----------------------------------------------------------------------------------------------------
  181.         <DebuggerNonUserCode>
  182.         Private Sub New()
  183.         End Sub
  184.  
  185.         ''' ----------------------------------------------------------------------------------------------------
  186.         ''' <summary>
  187.         ''' Initializes a new instance of the <see cref="ControlDragInfo"/> class.
  188.         ''' </summary>
  189.         ''' ----------------------------------------------------------------------------------------------------
  190.         ''' <param name="ctrl">
  191.         ''' The owner <see cref="Control"/>.
  192.         ''' </param>
  193.         ''' ----------------------------------------------------------------------------------------------------
  194.         <DebuggerStepThrough>
  195.         Public Sub New(ByVal ctrl As Control)
  196.             Me.controlB = ctrl
  197.             Me.Cursor = ctrl.Cursor
  198.         End Sub
  199.  
  200. #End Region
  201.  
  202.     End Class
  203.  
  204. End Namespace
  205.  
  206. #End Region
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement