|
-
Apr 7th, 2009, 12:38 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Draw to an icon?
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.
-
Apr 7th, 2009, 12:40 PM
#2
Re: Draw to an icon?
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?
-
Apr 7th, 2009, 12:58 PM
#3
Thread Starter
Hyperactive Member
Re: Draw to an icon?
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.
-
Apr 7th, 2009, 01:07 PM
#4
Re: Draw to an icon?
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.
-
Apr 7th, 2009, 01:08 PM
#5
Thread Starter
Hyperactive Member
Re: Draw to an icon?
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.
-
Apr 7th, 2009, 01:14 PM
#6
Re: Draw to an icon?
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
-
Apr 7th, 2009, 01:30 PM
#7
Re: Draw to an icon?
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
-
Apr 7th, 2009, 01:32 PM
#8
Thread Starter
Hyperactive Member
Re: Draw to an icon?
Sparrow thanks, but that's not what I need. Atheist provided the correct solution. THANKS ATHEIST!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|