Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports Telerik.WinControls
- Imports Telerik.WinControls.UI
- Imports System.IO
- Public Class Form4
- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- ThemeResolutionService.ApplicationThemeName = "Office2010Blue"
- End Sub
- Private btn As Button ' this is a reference object
- Private ptX, ptY As Integer
- Private drag As Boolean
- Private Sub nodebtn_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
- If e.Button = MouseButtons.Left Then
- drag = True
- btn = CType(sender, Button)
- ptX = e.X : ptY = e.Y
- End If
- End Sub
- Private Sub nodebtn_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
- If drag Then
- btn.Location = New Point(btn.Location.X + e.X - ptX, btn.Location.Y + e.Y - ptY)
- Me.Refresh()
- End If
- End Sub
- Private Sub nodebtn_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
- drag = False
- End Sub
- Private Sub nodebtn_MouseClick(ByVal sender As System.Object, ByVal e As System.EventArgs)
- End Sub
- Private Sub Form2_MouseHover(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.MouseHover
- End Sub
- Private Sub Form2_DragEnter(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles MyBase.DragEnter
- End Sub
- Private Sub Form2_MouseUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
- End Sub
- Private Sub Form2_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
- End Sub
- Private Sub CreateFileToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CreateFileToolStripMenuItem.Click
- Dim b As New Button
- Dim LocalMousePosition As Point
- LocalMousePosition = PointToClient(Cursor.Position)
- b.Text = Nothing
- b.FlatStyle = FlatStyle.Flat
- b.Size = New Point(33, 23)
- b.BackColor = Color.Transparent
- b.BackgroundImage = My.Resources.file_extension_bin
- b.BackgroundImageLayout = ImageLayout.Stretch
- b.Location = New Point(LocalMousePosition.X, LocalMousePosition.Y)
- b.FlatAppearance.BorderSize = 0
- AddHandler b.MouseDown, AddressOf nodebtn_MouseDown
- AddHandler b.MouseMove, AddressOf nodebtn_MouseMove
- AddHandler b.MouseUp, AddressOf nodebtn_MouseUp
- AddHandler b.MouseClick, AddressOf nodebtn_MouseClick
- Me.Controls.Add(b)
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement