How can I draw something to an icon? I am unable to get the graphics from an icon, so that I can use the DrawLine procedures etc.
I really want to know this. And it needs to be done in-memory, and should not use files to store the icons.
Printable View
How can I draw something to an icon? I am unable to get the graphics from an icon, so that I can use the DrawLine procedures etc.
I really want to know this. And it needs to be done in-memory, and should not use files to store the icons.
so you want to grab an existing icon file, do something with it like draw a line on it?
And then what? You said it should not store the icon as a file, so what exactly do you want to do? grab an icon, draw on it, and then use it in the application?
Wow! You are the main administrator of VBForums! Cool!
Anyway, back to subject.
After loading the icon as a variable, manipulating it by drawing a line on it (or anything else), I would like to display it as the icon in a NotifyIcon control.
Hi,
First of all, grap someone else created icon is in my opion not a good idee, however create your own would be must better. There are many programs where you can create icons.
Then you can create a notifyicon here.
I need to be able to draw to the icon. I want the icon to show a number telling the user how many items there are available in a listbox.
I believe you'd have to do something like this:
Code:Dim myIcon As Icon = New Icon("F:\windows\mic.ico")
Dim myIconBitmap As Bitmap = myIcon.ToBitmap()
Using g As Graphics = Graphics.FromImage(myIconBitmap)
g.FillRectangle(Brushes.Red, New Rectangle(0, 0, 10, 10))
End Using
myIcon.Dispose()
myIcon = Icon.FromHandle(myIconBitmap.GetHicon())
myIconBitmap.Dispose()
myNotifyIcon.Icon = myIcon
Hi,
Add a notifyicon to your application and select in the properties wich icon you need. Then change the text with the Listbox.objectcollection.count property to draw the totale of items there are in the listbox.
Something like this:
vb Code:
Dim filecount As Integer filecount = ListBox1.Items.Count filecount += 1 Notifyicon1.Text = filecount
Sparrow thanks, but that's not what I need. Atheist provided the correct solution. THANKS ATHEIST!