-
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
-
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
-
thanx for that aaron, but that reduces the icons colors to 16 colors, is there a way to keep the icons orignal colors?