iCon Block - SpinOff
Heres your chance to share your own tutorials with the community. Just post them on here. If your lucky they may even be posted on the main site.
Hello all
Ive got another little tutorial for you, although its more of a re-codeing. Ive taken the code of Application Launcher Bar and mixed it around and added a few things to make a different kindof launcher.
This one is in the form of a block which sits in the middle of the screen and can hold 60 icon shortcuts for quick access to your favourite programs. Ill tell you the features of this one first:
Double-Click now hides the block
Taskbar icon for launching the block
Can choose transparency
Themes
Always on top (on/off)
Icon descriptions (hovering over an icon will now tell you where it leads/what it opens)
Can turn descriptions on/off
You can now add folders to the block (represented by custom folder icon)
You can also add harddrive links to the block (represented by custom harddrive icon)
Ill be updating the original Application Launcher Bar with the icon upgrade code in just a minute for those of you who still want to use the original, we all get equal rights in here
OK onto the quick and easy tutorial.
First you need to start a new project and make the form have the dimensions of 526, 332 no more and no less.
Now you need to add the following controls and things to your form like this:
ContextMenuStrip with the following menus:
Now you need to change the 'CheckonClick' propertie to "True" on the following menus - Always on Top ...Descriptions on/off...Remove
You will also need an OpenFileDialog and NotifyIcon control on your form. Choose an icon for notifyicon and change the propertie 'ContextMenu' to your contextmenustrip you made earlier...do the same for form1's 'Contextmenu' propertie.
Also change Form1s show in taskbar propertie to 'False' because we dont want it laying about.
Almost finished. Now you need to add 2 embedded resources to your project, these are *.ico files. You need:
1 called Folder.ico
1 called Harddrive.ico
Those are used to represent the folders and harddrives if you place them on the block, choose ones to suit your windows theme.
I used these ones: ... ...they may look grainy but when you save them to your comp they look fine ;)
Now for the code and its a simple cut and paste job:
And thats you finished
Source-code for this tutorial:
Enjoy!. Any questions please ask and I will help.
Ive got another little tutorial for you, although its more of a re-codeing. Ive taken the code of Application Launcher Bar and mixed it around and added a few things to make a different kindof launcher.
This one is in the form of a block which sits in the middle of the screen and can hold 60 icon shortcuts for quick access to your favourite programs. Ill tell you the features of this one first:
Double-Click now hides the block
Taskbar icon for launching the block
Can choose transparency
Themes
Always on top (on/off)
Icon descriptions (hovering over an icon will now tell you where it leads/what it opens)
Can turn descriptions on/off
You can now add folders to the block (represented by custom folder icon)
You can also add harddrive links to the block (represented by custom harddrive icon)
Ill be updating the original Application Launcher Bar with the icon upgrade code in just a minute for those of you who still want to use the original, we all get equal rights in here
OK onto the quick and easy tutorial.
First you need to start a new project and make the form have the dimensions of 526, 332 no more and no less.
Now you need to add the following controls and things to your form like this:
ContextMenuStrip with the following menus:
Now you need to change the 'CheckonClick' propertie to "True" on the following menus - Always on Top ...Descriptions on/off...Remove
You will also need an OpenFileDialog and NotifyIcon control on your form. Choose an icon for notifyicon and change the propertie 'ContextMenu' to your contextmenustrip you made earlier...do the same for form1's 'Contextmenu' propertie.
Also change Form1s show in taskbar propertie to 'False' because we dont want it laying about.
Almost finished. Now you need to add 2 embedded resources to your project, these are *.ico files. You need:
1 called Folder.ico
1 called Harddrive.ico
Those are used to represent the folders and harddrives if you place them on the block, choose ones to suit your windows theme.
I used these ones: ... ...they may look grainy but when you save them to your comp they look fine ;)
Now for the code and its a simple cut and paste job:
Code: Select all
Imports System.Runtime.InteropServices
Imports System.IO
Public Class Form1
Public rowz = 20
Public cols = 5
'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(50, 50)
CType(sender, PictureBox).Location = New Point(sender.Location.X, sender.Location.Y)
Label3.Text = CType(sender, PictureBox).Tag.ToString
End Sub
Private Sub Lab_MouseLeave(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, sender.Location.Y)
Label3.Text = "Welcome to iCon Block - www.codenstuff.com"
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 RemoveToolStripMenuItem.Checked = True Then
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
Dim back = Convert.ToString(My.Settings.backg)
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
Dim shortcut, starget As String
Dim oshelllink
Dim wsh As Object = CreateObject("WScript.Shell")
wsh = CreateObject("WScript.Shell")
shortcut = line
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(line)
Dim s = ico.ToBitmap
w.Image = s
End Using
Catch wex As Exception
If line.Length = 3 Then
Using ico As Icon = My.Resources.Harddrive
Dim s = ico.ToBitmap
w.Image = s
End Using
Else
Using ico As Icon = My.Resources.Folder
Dim s = ico.ToBitmap
w.Image = s
End Using
End If
End Try
End Try
If rowz = 520 Then
rowz = 20
cols += 50
End If
w.Location = New Point(rowz, cols)
w.Size = New Size(40, 40)
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.Controls.Add(w)
rowz += 50
End If
Next
End If
If back = "" Then
Else
Me.BackgroundImage = System.Drawing.Image.FromFile(back)
End If
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 rowz = 520 And cols = 205 Then
MsgBox("You have reached the limit. Please remove some icons to add more.")
Else
If e.Data.GetDataPresent(DataFormats.FileDrop) Then
Dim draggedFiles As String() = CType(e.Data.GetData(DataFormats.FileDrop), String())
For Each filename As String In draggedFiles
RichTextBox1.AppendText(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 = 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(filename)
Dim s = ico.ToBitmap
w.Image = s
End Using
Catch wex As Exception
If 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 rowz = 520 Then
rowz = 20
cols += 50
End If
w.Location = New Point(rowz, cols)
w.Size = New Size(40, 40)
w.Tag = filename
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.Controls.Add(w)
rowz += 50
Next
saveme()
End If
End If
End Sub
'CHECKS TO MAKE SURE ITEM DRAGGED IS A FILE
Private Sub Form1_DragEnter(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles MyBase.DragEnter
If e.Data.GetDataPresent(DataFormats.FileDrop) Then
e.Effect = DragDropEffects.Copy
End If
End Sub
'SAVES THE SHORTCUTS
Public Sub saveme()
If My.Computer.FileSystem.FileExists(Application.StartupPath + "\Settings.bar") Then
My.Computer.FileSystem.DeleteFile(Application.StartupPath + "\Settings.bar", FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.DeletePermanently)
End If
My.Computer.FileSystem.WriteAllText(Application.StartupPath + "\Settings.bar", RichTextBox1.Text, True)
End Sub
Private Sub Form1_MouseDoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDoubleClick
Me.Hide()
End Sub
Private Sub RemoveToolStripMenuItem_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RemoveToolStripMenuItem.CheckedChanged
If RemoveToolStripMenuItem.Checked = False Then
Application.Restart()
End If
End Sub
Private Sub ThemeToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ThemeToolStripMenuItem.Click, ThemeToolStripMenuItem.CheckedChanged
If OpenFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
Me.BackgroundImage = System.Drawing.Image.FromFile(OpenFileDialog1.FileName)
My.Settings.backg = OpenFileDialog1.FileName
My.Settings.Save()
End If
End Sub
Private Sub AlwaysToolStripMenuItem_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AlwaysToolStripMenuItem.CheckedChanged
If AlwaysToolStripMenuItem.Checked = False Then
Me.TopMost = False
Else
Me.TopMost = True
End If
End Sub
Private Sub NotifyIcon1_MouseClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseClick
Me.Show()
End Sub
Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
NotifyIcon1.Dispose()
Me.Close()
End Sub
Private Sub ToolStripMenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem2.Click
Me.Opacity = 100.0
Me.Refresh()
End Sub
Private Sub ToolStripMenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem3.Click
Me.Opacity = 75.0 / 100
End Sub
Private Sub ToolStripMenuItem4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem4.Click
Me.Opacity = 50.0 / 100
Me.Refresh()
End Sub
Private Sub ToolStripMenuItem5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem5.Click
Me.Opacity = 25.0 / 100
Me.Refresh()
End Sub
Private Sub DescriptionsOnOffToolStripMenuItem_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DescriptionsOnOffToolStripMenuItem.CheckedChanged
If DescriptionsOnOffToolStripMenuItem.Checked = False Then
Label3.Visible = False
Else
Label3.Visible = True
End If
End Sub
End Class
And thats you finished
Source-code for this tutorial:
Enjoy!. Any questions please ask and I will help.
You do not have the required permissions to view the files attached to this post.
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
Code: Select all
If IConBlockSpinoff.IsGreat = True Then
Nery.happiness = 100%
Else
Nery.WouldDo = ReportAllErrorsToCodenstuff
Endif
RunarM wrote:How can i make it possible to move it?Here:
Code: Select all
correct me if i'm wrong! Form1.Postion= My.Computer.Mouse.Location
Martin64 wrote:It Dident Work Good For Me But I Like It clapper; clapper; clapper;yup i agree
i have a question in the code what type is, "backg" and what does it say?
Copyright Information
Copyright © Codenstuff.com 2020 - 2023