|
Module MainModule
Dim WithEvents m_oDimmableMenuControl As WobblyMenu.Control.DimmableMenu
Sub Main()
m_oDimmableMenuControl = New WobblyMenu.Control.DimmableMenu()
m_oDimmableMenuControl.ItemSize = New Size(60, 60)
m_oDimmableMenuControl.Font = New Font("Arial", 6, FontStyle.Regular)
'Loading previously loaded values
AddItems(My.Settings.Links.Split(";".ToCharArray(), StringSplitOptions.RemoveEmptyEntries))
AddHandler m_oDimmableMenuControl.OnClose, AddressOf AppCloser
m_oDimmableMenuControl.Show()
Application.Run()
End Sub
Private Sub AppCloser()
Application.Exit()
End Sub
Private Sub Control_OnDragDrop(ByVal eventObject As Object, ByVal dragArgs As System.Windows.Forms.DragEventArgs) Handles m_oDimmableMenuControl.OnDragDrop
Dim sStoredValues As String = My.Settings.Links
Dim oVals() As String = DirectCast(dragArgs.Data.GetData(DataFormats.FileDrop), String())
For iLoop As Integer = 0 To oVals.Length - 1
If sStoredValues.Contains(oVals(iLoop)) Then
oVals(iLoop) = String.Empty
Else
sStoredValues += ";" + oVals(iLoop)
End If
Next
AddItems(oVals)
My.Settings.Links = sStoredValues
My.Settings.Save()
End Sub
Private Sub ItemClickHandler(ByVal e As WobblyMenu.Control.MenuItem)
Try
Process.Start(e.Tag)
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Private Sub AddItems(ByVal items() As String)
For Each sFile As String In items
If String.IsNullOrEmpty(sFile) Then Continue For
If IO.Directory.Exists(sFile) Then
AddItems(IO.Directory.GetFiles(sFile))
Else
Dim oItem As WobblyMenu.Control.MenuItem = m_oDimmableMenuControl.MenuItems.AddMenuItem( _
sFile.Substring(sFile.LastIndexOf("\") + 1), _
Drawing.Icon.ExtractAssociatedIcon(sFile).ToBitmap)
With oItem
.Tag = sFile
AddHandler .OnClick, AddressOf ItemClickHandler
End With
End If
Next
m_oDimmableMenuControl.Refresh()
End Sub
End Module
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Having more than 10 years experience in software development and currently working for eHips Ltd in Oxford, UK. Expert in C# and VB.NET. Also Expert in technologies such as GDI+, ADO.NET, XML, XSD etc. Started the career as a VB6.0 developer and moved on to .NET with its beta release. Experience includes real-time system development, distributed systems, Work flow systems, control system development and web 2.0 systems.