Results 1 to 3 of 3

Thread: Icons.

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2000
    Location
    West Launceston
    Posts
    15

    Post

    How do you save an icon in vb so it is recognised properly? I know you can save it this way: SavePicture Picture1.picture, C:\What.ico

    but when I save an icon like that, nothing that supports icons recognises it, say I open it up in a icon editing program it will either peform an illegal op or say a message like invalid file or icon or something. Even when you try to make your icon be that icon in vb it give you and error. Is there a way to save it so it is recognised as a proper icon?

    Also how to you place an icon on the clipboard
    i tried this, clipboard.setdata picture1.picture
    but that didn't work.

    And is there an easy way to filp a picture in a picture box?

    thanx in advance


  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    The VB Picturebox will only Save Modified Images as Bitmap files, to Save as an Icon the Picture needs to have been Assigned an Icon Image, to do this, use the ImageList Control, which has an ExtractIcon Method, ie.
    Code:
    'Add a Picturebox, ImageList and Command Button to a Form..
    Private Sub Command1_Click()
        With ImageList1
            .ListImages.Add , "NewIcon", Picture1
            'Set the transparent Color of the Icon
            .MaskColor = vbButtonFace
            'ReAssign the Icon to the Picturebox,
            'It'll now save it as an Icon as it's in an Icon Format
            Picture1 = .ListImages("NewIcon").ExtractIcon
            'Remove the Image from the ImageList
            .ListImages.Remove "NewIcon"
            'Save the Icon
            SavePicture Picture1, "C:\NewIcon.ico"
        End With
    End Sub

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2000
    Location
    West Launceston
    Posts
    15

    Post

    thanx for that aaron, but that reduces the icons colors to 16 colors, is there a way to keep the icons orignal colors?

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