home *** CD-ROM | disk | FTP | other *** search
/ ftp.tcs3.com / ftp.tcs3.com.tar / ftp.tcs3.com / DRIVERS / Audio / Office2010 / InfoPath.en-us / InfLR.cab / FL_MoveaWindowbyDraggingtheClientAreaofthe_142707_ENU____.3643236F_FC70_11D3_A536_0090278A1BB8 < prev    next >
Extensible Markup Language  |  2008-09-17  |  2KB  |  69 lines

  1. <?xml version="1.0"?>
  2. <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  3.   <CodeSnippet Format="1.0.0">
  4.     <Header>
  5.       <Title>Move a Window by Dragging the Client Area of the Form</Title>
  6.       <Author>Microsoft Corporation</Author>
  7.       <Description>Moves a form by dragging any part of it with the mouse. This feature is particularly useful when the form has no title bar.</Description>
  8.       <Shortcut>formDrag</Shortcut>
  9.     </Header>
  10.     <Snippet>
  11.       <References>
  12.         <Reference>
  13.           <Assembly>System.Drawing.dll</Assembly>
  14.         </Reference>
  15.         <Reference>
  16.           <Assembly>System.Windows.Forms.dll</Assembly>
  17.         </Reference>
  18.         <Reference>
  19.           <Assembly>System.dll</Assembly>
  20.         </Reference>
  21.       </References>
  22.       <Imports>
  23.         <Import>
  24.           <Namespace>Microsoft.VisualBasic</Namespace>
  25.         </Import>
  26.         <Import>
  27.           <Namespace>System.Drawing</Namespace>
  28.         </Import>
  29.         <Import>
  30.           <Namespace>System.Windows.Forms</Namespace>
  31.         </Import>
  32.         <Import>
  33.           <Namespace>System</Namespace>
  34.         </Import>
  35.       </Imports>
  36.       <Declarations>
  37.         <Object>
  38.           <ID>mouseOffset</ID>
  39.           <Type>Point</Type>
  40.           <ToolTip>The offset of the mouse cursor.</ToolTip>
  41.           <Default>mouseOffset</Default>
  42.         </Object>
  43.         <Object>
  44.           <ID>formName</ID>
  45.           <Type>Form</Type>
  46.           <ToolTip>The form in which the snippet is inserted.</ToolTip>
  47.           <Default>Me</Default>
  48.         </Object>
  49.       </Declarations>
  50.       <Code Language="VB" Kind="method decl"><![CDATA[Private Sub $formName$_MouseDown(ByVal sender As Object, _
  51.     ByVal e As MouseEventArgs) _
  52.     Handles MyBase.MouseDown
  53.  
  54.     $mouseOffset$ = New Point(-e.X, -e.Y)
  55. End Sub
  56.  
  57. Private Sub $formName$_MouseMove(ByVal sender As Object, _
  58.     ByVal e As MouseEventArgs) _
  59.     Handles MyBase.MouseMove
  60.  
  61.     If e.Button = MouseButtons.Left Then
  62.         Dim mousePos As Point = Control.MousePosition
  63.         mousePos.Offset($mouseOffset$.X, $mouseOffset$.Y)
  64.         Location = mousePos
  65.     End If
  66. End Sub]]></Code>
  67.     </Snippet>
  68.   </CodeSnippet>
  69. </CodeSnippets>