Application Bar Update - Browse Folders
Posted: Thu Nov 12, 2009 4:23 pm
Hello,
If you want to add the option to browse for files to add to the Icon Bar then first add a new option to the "ContextMenuStrip" control, I called it 'Browse' and then add this code in its click_event:
If you want to add the option to browse for files to add to the Icon Bar then first add a new option to the "ContextMenuStrip" control, I called it 'Browse' and then add this code in its click_event:
Code: Select all
Happy coding cooll; Dim browse As New OpenFileDialog
If browse.ShowDialog = Windows.Forms.DialogResult.OK Then
RichTextBox1.AppendText(browse.FileName + vbNewLine)
Dim w As New PictureBox
'**********************************************
Try
Dim shortcut, starget As String
Dim oshelllink
Dim wsh As Object = CreateObject("WScript.Shell")
wsh = CreateObject("WScript.Shell")
shortcut = browse.FileName
oshelllink = wsh.CreateShortcut(shortcut)
starget = oshelllink.TargetPath
'**********************************************
Using ico As Icon = Drawing.Icon.ExtractAssociatedIcon(starget)
Dim s = ico.ToBitmap
w.Image = s
End Using
Catch ex As Exception
Try
Using ico As Icon = Drawing.Icon.ExtractAssociatedIcon(browse.FileName)
Dim s = ico.ToBitmap
w.Image = s
End Using
Catch wex As Exception
If browse.FileName.Length = 4 Then
Using ico As Icon = My.Resources.Harddrive
Dim s = ico.ToBitmap
w.Image = s
End Using
End If
Using ico As Icon = My.Resources.Folder
Dim s = ico.ToBitmap
w.Image = s
End Using
End Try
End Try
If horv = "top" Then
w.Location = New Point(rowz, 5)
If numic > 4 Then
Me.Width += 40
End If
Me.CenterToScreen()
Me.Top = Screen.PrimaryScreen.Bounds.X
ElseIf horv = "left" Then
w.Location = New Point(5, rowz)
Me.Height += 40
' Me.Width -= 10
Me.CenterToScreen()
Me.Left = Screen.PrimaryScreen.Bounds.Y
ElseIf horv = "right" Then
w.Location = New Point(5, rowz)
Me.Height += 40
' Me.Width -= 10
Me.CenterToScreen()
Me.Left = Screen.PrimaryScreen.WorkingArea.Width + -Me.Width
ElseIf horv = "bottom" Then
w.Location = New Point(rowz, 5)
Me.Width += 40
Me.CenterToScreen()
'Me.Left = Screen.PrimaryScreen.Bounds.Width - Me.Width
' Me.Top = Screen.PrimaryScreen.Bounds.Height + -Me.Height
Me.Top = Screen.PrimaryScreen.WorkingArea.Height - Me.Height
End If
w.Size = New Size(30, 30)
w.Tag = browse.FileName
w.BackColor = Color.Transparent
AddHandler w.Click, AddressOf Fclick
AddHandler w.MouseEnter, AddressOf Lab_MouseEnter
AddHandler w.MouseLeave, AddressOf Lab_MouseLeave
Me.Controls.Add(w)
'Me.Width += 40
rowz += 40
numic += 1
Label2.Visible = False
saveme()
End If