Escolar Documentos
Profissional Documentos
Cultura Documentos
InteropServices
Imports System.IO
Public Class Form1
Public rowz = 50
'HANDLES MOUSE EVENTS WHEN MOUSE MOVES OVER AN ICON ON BAR
Private Sub Lab_MouseEnter(ByVal sender As System.Object, ByVal e As
System.EventArgs)
CType(sender, PictureBox).Size = New Size(40, 40)
CType(sender, PictureBox).Location = New Point(sender.Location.X - 5,
sender.Location.Y)
End Sub
'THIS IS WHAT HAPPENS WHEN YOU CLICK AN ICON ON THE BAR - OPENS or
DELETES
Private Sub Fclick(ByVal sender As System.Object, ByVal e As System.EventArgs)
If CheckBox1.Checked = TrueThen
Dim findlink As String = CType(sender, PictureBox).Tag.ToString
Dim replace As String = ""
Dim indx As Integer = RichTextBox1.Find(findlink)
If indx <> -1 Then
RichTextBox1.Select(indx, findlink.Length)
If RichTextBox1.SelectedText <> ""Then
RichTextBox1.SelectedText = replace
End If
End If
CType(sender, PictureBox).Dispose()
saveme()
Else
Dim w = CType(sender, PictureBox).Tag.ToString
System.Diagnostics.Process.Start(w)
End If
End Sub
'READS SAVED ICONS AND LOADS THEM AT STARTUP INTO THE BAR
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If My.Computer.FileSystem.FileExists(Application.StartupPath + "\Settings.bar") Then
Dim lines = IO.File.ReadAllLines(Application.StartupPath + "\Settings.bar")
For Each line As String In lines
If line <> ""Then
RichTextBox1.AppendText(line + vbNewLine)
Dim w As New PictureBox
Try
Using ico As Icon = Drawing.Icon.ExtractAssociatedIcon(line)
Dim s = ico.ToBitmap
w.Image = s
End Using
Catch
w.BackColor = Color.Aqua
End Try
w.Location = New Point(rowz, 5)
w.Size = New Size(30, 30)
w.Tag = line
w.BackColor = Color.Transparent
w.SizeMode = PictureBoxSizeMode.StretchImage
AddHandler w.Click, AddressOf Fclick
AddHandler w.MouseEnter, AddressOf Lab_MouseEnter
AddHandler w.MouseLeave, AddressOf Lab_MouseLeave
Me.Width += 40
Me.Controls.Add(w)
rowz += 40
End If
Next
End If
Me.CenterToScreen()
Me.Top = Screen.PrimaryScreen.Bounds.X
End Sub
'DETECTS PROGRAM DRAGGED ONTO BAR AND ADDs IT and SHOWS ITS ICON
Private Sub Form1_DragDrop(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.DragEventArgs) Handles MyBase.DragDrop
If e.Data.GetDataPresent(DataFormats.FileDrop) Then
Dim draggedFiles As String() = CType(e.Data.GetData(DataFormats.FileDrop),
String())
If e.Data.GetDataPresent(DataFormats.FileDrop) Then
e.Effect = DragDropEffects.Copy
End If
End Sub