Actually, the icon is not fixed. The user selects icon at the runtime and I want to show its preview under image control. The icons source may be (*.ico, *.exe and *.dll).
@LeandroA:
Well, I didn't understand the language used in the site. I downloaded it. But what must be me doing with it? I didn't get any clues. Also, I can't upload icons.
Time to use your friends (yahoo, google, ask, answers bing) and search for vb6 extracticonex. When you retrieve your results, make sure you check out both thescarms and vbaccelerator 's example programs...
Easy to do, but quality will suffer. One can convert 32bpp to 24bpp which is supported. But 32bpp are generally alphablended giving you nice blended shadows for example. Converting to 24bpp means those shadows will no longer be blended, but solid, and will result in poor quality. The real answer is to not convert those icons for .Picture/.Icon properties but to draw them directly on the form/picturebox using the DrawIconEx API and you will get the best quality; but this does require some more code. The Image Control is a convenient tool, but not for modern graphics. Also, 32bpp icons are supported in XP and above only.
Insomnia is just a byproduct of, "It can't be done"
Look at the Icon Organizer link in my signature and sample code is in post #1 in that link: Bonus Code #2.
Another answer is to not use 32bpp icons or remove them from the icon file/resource. But if your users can pick any icon, then that may not be so easy as the icon may only consist of 32bpp formats.
Insomnia is just a byproduct of, "It can't be done"
Ok, in order to us the DrawIconEx API, you will need an hIcon handle. There are a few ways to get that handle
1) Read the bytes into an array using VB & Binary file mode. Use the sample code I mentioned and create an Icon from the first icon in the file. (example given in that link)
2) Use other APIs like LoadImage (example given in that link)
3) Manually parse the icon file which I don't think you want to do
The only thing not given in that link is an example of DrawIconEx. It is so easy to use.
If you create an icon, you must remember to destroy it at some point else memory leaks can occur.
Insomnia is just a byproduct of, "It can't be done"
Alright. The function DrawIconEx works well. I'm using transparent frame and the area where icon is to be drawn is covered by the same frame. But after drawing, the icon doesn't appear.
Alright. The function DrawIconEx works well. I'm using transparent frame and the area where icon is to be drawn is covered by the same frame. But after drawing, the icon doesn't appear.
What code are you using for making the frame transparent ? Try calling that sub/function, which will make the frame transparent, after drawing the icon.
...
If my post was helpful to you, then express your gratitude using Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video) My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet Social Group:VBForums - Developers from India
Or, try hiding and showing that frame control, after drawing.
Example:
Code:
Frame1.Visible=False
DrawICON
Frame1.Visible=True
...
If my post was helpful to you, then express your gratitude using Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video) My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet Social Group:VBForums - Developers from India
Can you send me a sample to work out ? Try to include the transparent OCX also. I will experiment it...
If my post was helpful to you, then express your gratitude using Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video) My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet Social Group:VBForums - Developers from India
I have tried it, but it looks like the Transparent Frame control use to paint the background on app loading only. I have tried assigning the transparency property at runtime. But that too doesn't show any effect.
May be you should display the picture somewhere else.
If you want to display the icon in a picturebox, you can try this in DrawIconEx line:
If my post was helpful to you, then express your gratitude using Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video) My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet Social Group:VBForums - Developers from India
Alright. Now I've placed picturebox set its border style to none. It works as I had wanted.
Thanks a lot!!!
You're welcome...
If my post was helpful to you, then express your gratitude using Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video) My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet Social Group:VBForums - Developers from India