Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ICON on Title Bar of FORM
Message
From
10/12/2007 15:13:52
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01274501
Message ID:
01274559
Views:
15
>>>>Okay, what is AFAIK for the uneducated?
>>>>
>>>>And, is there some software you could refer me to that would do the BitMapt to ICON conversion easily?
>>>>
>>>>>No, AFAIK you have to convert your BMP to ICO.
>>>
>>>:-)
>>>
>>>As Far As I Know
>>>
>>>Axialis Icon Workshop. They have Trial version AFAIK :-)
>>
>>Yes, it could be it.
>>
>>Re: Attached icon not attached Thread #1067940 Message #1191749
>>
>>:)
>>
>>Thanks.
>
>Yep,
>But I like Sergey's suggestion more :-)
>1. Because all there is pure VFP
>2. It is free
>3. It is written by Cezar :-)
>
>I want to kick myself on my ... why it didn't comes to my mind first.


Below are 4 simple ways to convert a BMP to ICON, using GdiPlusX.
Those 2 blog posts were before we updated the library, adding the support for saving Icons with good quality.

This sample uses 4 techniques, and creates 4 versions of ICONS from the same image file.
Before the conversion, it resizes the source image to the size of 16x16. This means that with this sample you can convert any image to ICO file.
Do Locfile("system.prg")

With _Screen.System.Drawing As xfcDrawing

* Convert the original bitmap to ensure better quality and compatibility
   loResized = .Bitmap.New(.Bitmap.FromFile(Getpict()), 16,16)
   
* Create Icon Object
    Local loIcon As xfcIcon
    loIcon = .Icon.FromHandle(loResized.GetHicon())

*** LOW QUALITY ICONS

* Save sending FileName
    loIcon.Save("c:\Icon_Save_FileName_LowQual.ico")

* Save Using Stream
    Local loStream As xfcMemoryStream
    loStream = _Screen.System.IO.MemoryStream.New()

    loIcon.Save(loStream)
    Strtofile(loStream.GetBuffer(), "c:\Icon_Save_Stream_LowQual.Ico")


*** HIGH QUALITY ICONS
*** Setting the tlQuality flag to .T.

* Save sending FileName
    loIcon.Save("c:\Icon_Save_FileName_HighQual.ico", .T.)

* Save Using Stream
    Local loStream2 As xfcMemoryStream
    loStream2 = _Screen.System.IO.MemoryStream.New()

    loIcon.Save(loStream2, .T.)
    Strtofile(loStream2.GetBuffer(), "c:\Icon_Save_Stream_HighQual.Ico")

Endwith
Hope this helps

Cesar
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform