Results 1 to 5 of 5

Thread: BMP to Ico code

  1. #1

    Thread Starter
    Addicted Member Cbomb's Avatar
    Join Date
    Jul 1999
    Posts
    153

    Lightbulb

    Does anyone know of some code that will load a BMP as an ICO? I have about 25 pics in BMP format and I dont want to convert them all to ICO using MicroAngelo or something..it would just be too tedious. And I have to use the pics as DragIcons

    Thanks in advance
    Cbomb
    Techie

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Add a Imagelist in your app, add the bitmap to the imagelist and use it's extracticon method to create the icon, savepicture directly with that icon without having it on the picturebox or it won't be in ico format
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3
    Guest
    Add the following code to a Form with an ImageList, PictureBox and CommandButton.
    Code:
    Private Sub Command1_Click()
        ImageList1.ListImages.Add , "Pic1", Picture1.Picture
        Picture1 = Nothing
        Picture1 = ImageList1.ListImages(1).ExtractIcon
        SavePicture Picture1, "C:\WINDOWS\DESKTOP\MYICON.ICO"
    End Sub
    Make sure there is a picture loaded in the PictureBox. When you press the CommandButton, it will convert the picture to an icon and save it on to your desktop with the name of MyIcon.ico.

  4. #4

    Thread Starter
    Addicted Member Cbomb's Avatar
    Join Date
    Jul 1999
    Posts
    153

    This should be the last Q

    Ok i see how that works...and i thought i could modify it but i guess not.... this code gives me an "index out of bounds" error at: TileList.ListImages.Add i, "Tile" & Str(i), Tile(i).Picture

    Code:
        For i = 0 To 13
            TileList.ListImages.Add i, "Tile" & Str(i), Tile(i).Picture
            tmppic = Nothing
            tmppic = TileList.ListImages(i).ExtractIcon
            SavePicture tmp, "C:\Graphics\RPG\tiles\icons\Tile" & Str(i) & ".ico"
        Next i
    Can ya tell me what im doing wrong here?...thanks again
    Cbomb
    Techie

  5. #5

    Thread Starter
    Addicted Member Cbomb's Avatar
    Join Date
    Jul 1999
    Posts
    153

    Smile N/m

    Nevermind guys i got it..thanks for your help
    Cbomb
    Techie

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width