Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

[Mini TUT] Adding images to theme

I wanted to play around with themes, just for practicing and I wanted theme to display icon and images on buttons and such. After adding an image via properties tab, it didn't show so I banged my head few times thinking how hard this would be... But it's pretty easy.

[Image: YIG1Q.png]

Theme was made by TrinityCoder (https://hackforums.net/showthread.php?tid=1914676), hope he won't get mad because of this ^^"

Does the image look interesting? Y/N?
If not... Bye bye?

Where does the magic happen?
In theme code.

1. Put images into resources, I hope you know how.
2. Find a control that you would like to add an image to, and after all drawing code add:
Code
If Text = "Your-text-here" Then
      G.DrawImage(My.Resources.your-image, 0, 0)
End If

Code is self-explanati... (I don't know how to spell this).

And for the icon, add this code in theme drawing:
Code
G.DrawImage(Form1.Icon.ToBitmap, 0, 0)


Useful thing here is that you can add code on control that changes the text of one control, it will automatically change the image.

On my preview, if I click on "User" button, the text on groupbox will change to "User" and it will change the chat image to the image on the "User" button.

That would be it ^^ If you have any questions, PM me or just post here.
its look very nice . now we have this option . tnx for posting
NA man, I'm not mad you gave Credits AND added functionality :P

Good work, I hope others will use this to make some awesome themes from my base setup :) (and Aeons(Themebase))

Keep it up Slayer :P

Edit i did include an icon in the theme :) Look in the properties....

And their is a better way to do what your doing... checking If text is their is not the way to go.. you should make a property to add images in the properties.
Not bad, but the way you are doing it is kinda inefficient. It would be much easier to
just add the image and change the text than to add all of the resources to a project
then add the extra code to make it so that if it is certain text, use certain image. Just
my two cents though. Really great job and you actually got that REALLY clean. I like it.

~Vertex
The ThemeBase supports this already, you can just call..

Code
DrawImage(HorizontalAlignment.Left, 5, 0)

That will draw whatever is in the image property to the left of the control, offset from the right by 5 pixels.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by SIM-1517404Mar 5, 2017 02:39 PM 12 222 Mar 5, 2017 02:39 PM
Last Post: SIM-1517404
[C#] by Velozity™Oct 1, 2015 09:22 AM 12 453 Oct 1, 2015 09:22 AM
Last Post: klash hacker
[C#] by AspectModdingJan 27, 2015 07:16 AM 7 336 Jan 27, 2015 07:16 AM
Last Post: Astek