Application Bar Update - Folders/Harddrives

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.
14 posts Page 1 of 2
Contributors
User avatar
CodenStuff
Site Admin
Site Admin
Posts: 4389
Joined: Tue Aug 04, 2009 1:47 am

Hello,


A tiny update for the Application Bar now. This one will give you the ability to add folders and harddrives to your bar where as the previous versions had problems doing this.

You need to first add 2 embedded files to the project which will be *.ico files named the following:

1. Folder.ico
2. Harddrive.ico

You can choose your own icon images to match your windows theme or you can use these ones. Image..Image ..right-click and save image to your harddrive they wont look grainy I promise.

Once you have added those to the project you need to find the code below and change it as listed:

Find:
Code: Select all
 Catch ex As Exception
                        Using ico As Icon = Drawing.Icon.ExtractAssociatedIcon(line)
                            Dim s = ico.ToBitmap
                            w.Image = s
                        End Using
                    End Try
Change it to this:
Code: Select all
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
Find:
Code: Select all
 Catch ex As Exception
                    Using ico As Icon = Drawing.Icon.ExtractAssociatedIcon(filename)
                        Dim s = ico.ToBitmap
                        w.Image = s
                    End Using
                End Try
Change to this:
Code: Select all
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
Thats it :D all done. You should now be able add folders and harddrives to the bar without problems.

Need any help please ask.
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
User avatar
CodemaN
VIP Access - Denied
VIP Access - Denied
Posts: 74
Joined: Fri Sep 18, 2009 3:18 pm

thnxxx.....!!!!
User avatar
Neki
Top Poster
Top Poster
Posts: 96
Joined: Sun Oct 11, 2009 10:12 am

Thanks, and great choice of icons!
User avatar
Nery
Co-Admin Moderator
Co-Admin Moderator
Posts: 1117
Joined: Mon Sep 07, 2009 8:11 pm

Well if you keep like this you'll turn it in an application better then RocketDock :D
User avatar
Neki
Top Poster
Top Poster
Posts: 96
Joined: Sun Oct 11, 2009 10:12 am

That's true. :)
User avatar
bfh13
Just Registered
Just Registered
Posts: 5
Joined: Fri Jun 04, 2010 8:27 am

it works on folders but not harddrive
User avatar
Fede1591
Just Registered
Just Registered
Posts: 5
Joined: Mon Aug 10, 2015 9:49 pm

hello, I do not work , I get error:
My.Resources.Harddrive
My.Resources.Folder

" System.Drawing.Bitmap a value of type can not be converted into system.drawing.icon "
User avatar
CodenStuff
Site Admin
Site Admin
Posts: 4389
Joined: Tue Aug 04, 2009 1:47 am

Fede1591 wrote:
hello, I do not work , I get error:
My.Resources.Harddrive
My.Resources.Folder

" System.Drawing.Bitmap a value of type can not be converted into system.drawing.icon "
Did you use the images from this tutorial or your own?

Make sure they are .ico type files and not bitmaps or jpgs etc.
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
User avatar
Fede1591
Just Registered
Just Registered
Posts: 5
Joined: Mon Aug 10, 2015 9:49 pm

hello, and tested and follow me out the error:
" System.Drawing.Bitmap a value of type can not be converted into system.drawing.icon "

You could upload the file ?
thank you
User avatar
CodenStuff
Site Admin
Site Admin
Posts: 4389
Joined: Tue Aug 04, 2009 1:47 am

The images are in the first post:

Image

Image

You can just Right-Click and save as to your computer.
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
14 posts Page 1 of 2
Return to “Tutorials”