HowTo Set a jpg as form1 icon

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.
8 posts Page 1 of 1
Contributors
User avatar
Bogoh67
VIP - Site Partner
VIP - Site Partner
Posts: 656
Joined: Sun Apr 18, 2010 8:20 pm

HowTo Set a jpg as form1 icon
Bogoh67
fist create new application
then make a module
delete all code found and put
Code: Select all
Module Module1
    Public Sub MakeIcon()
        Dim b As Bitmap
        b = New Bitmap("PUT_NAME_HERE")
        Form1.Icon = DoWork(b, New Size(16, 16))
    End Sub
    Private Function DoWork(ByVal b As Bitmap, ByVal s As Size) As Icon
        Dim bitmap As New Bitmap(s.Width, s.Height)
        b = bitmap
        Return Icon.FromHandle(b.GetHicon())
    End Function
End Module
then go back to form1 and under formload
put
Code: Select all
MakeIcon()
User avatar
XTechVB
VIP - Site Partner
VIP - Site Partner
Posts: 727
Joined: Thu May 20, 2010 10:32 am

Re: HowTo Set a jpg as form1 icon
XTechVB
nice i never seen this before, i like new codes
Good Job Bogoh67 cooll;
You can find me on Facebook or on Skype mihai_92b
User avatar
r3Fuze
Just Registered
Just Registered
Posts: 6
Joined: Sat Oct 16, 2010 8:46 pm

Re: HowTo Set a jpg as form1 icon
r3Fuze
Thanks, im gonna use this :)
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

Re: HowTo Set a jpg as form1 icon
mandai
The DoWork function isn't actually making an icon from the jpg image. The code should look like this:
Code: Select all
    Private Function DoWork(ByVal b As Bitmap, ByVal s As Size) As Icon
        b = New Bitmap(b, s.Width, s.Height)
        Return Icon.FromHandle(b.GetHicon())
    End Function
User avatar
Skillful
Skillful Coders
Skillful Coders
Posts: 969
Joined: Tue Nov 16, 2010 10:07 am

Re: HowTo Set a jpg as form1 icon
Skillful
Thank you Cheatmsterbw!I'll use this.
Instead of LOL use this -
LSIBMHBIWFETALOL

Which means -
Laughing silently in between my head because it wasn't funny enough to actually laugh out loud!
User avatar
code it
VIP - Site Partner
VIP - Site Partner
Posts: 821
Joined: Sun Oct 10, 2010 3:02 pm

Re: HowTo Set a jpg as form1 icon
code it
CoderBoy1201 wrote:
Thank you Cheatmsterbw!I'll use this.
You meant bogoh67
User avatar
Usman55
VIP - Site Partner
VIP - Site Partner
Posts: 2821
Joined: Thu Dec 24, 2009 7:52 pm

Re: HowTo Set a jpg as form1 icon
Usman55
Nice code, And I think he said cheatmasterw cuz Bogoh's name's color is also same.
Image
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: HowTo Set a jpg as form1 icon
Dummy1912
:o

I never seen this before i always created my icons to use :D
but thanks now i can just use this clapper;

Thanks
Dummy1912
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
8 posts Page 1 of 1
Return to “Tutorials”