Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Icon Chalange
Dim img As New Bitmap(PictureBox1.Image, 32, 32)
img.Save(RichTextBox2.Text & "\" & RichTextBox3.Text & ".ico", System.Drawing.Imaging.ImageFormat.Bmp) MsgBox("Image has been converted", MsgBoxStyle.Information, "Done!") Hi all, I am using Visual Basic 2008. The above code saves PictureBox1 image into 32 x 32 icon file. The only problem I am facing that when I chose this icon file from the Properties of my Form as for Form icon in Visual Basic 2008 I get error message saying "Argument 'picture' must be a picture that can be used as a Icon". If I use same icon file from the Properties of Active X Control Button which is on excel Sheet then it works fine. I think if a icon file which can work on Visual Basic Form and as well as on Active X Control Button on an excel Sheet is the perfect icon. i tried different methods by searching on internet to create perfect 16 x 16 or 32 x 32 icon files which have no lost of colour or quality but only whith above code i get near to what i want to achive. But i cant use it for my Visual Basic application Form. I have created icon with below code which works everywhere but with below code you lose the quality and colors of the icon. I also studied "IconLib" example which you can find on internet but its to much for me. So i am kind of stuck. Is there any friend out there to help me out with some code. Dim pth As String = "C:\Document\test.gif" Dim img As New Bitmap(pth) Dim grh As Graphics = Graphics.FromImage(img) grh.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBicubic grh.DrawImage(img, 0, 0) Dim Hicon As IntPtr = img.GetHicon Dim newicon As Icon = System.Drawing.Icon.FromHandle(Hicon) Dim fpth As New IO.FileStream("C\Document\test.ico", IO.FileMode.Create) newicon.Save(fpth) newicon.Dispose() MsgBox("Image has been converted", MsgBoxStyle.Information, "Done!") |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Icon Chalange
K wrote :
Dim img As New Bitmap(PictureBox1.Image, 32, 32) img.Save(RichTextBox2.Text & "\" & RichTextBox3.Text & ".ico", System.Drawing.Imaging.ImageFormat.Bmp) MsgBox("Image has been converted", MsgBoxStyle.Information, "Done!") Hi all, I am using Visual Basic 2008. The above code saves PictureBox1 image into 32 x 32 icon file. The only problem I am facing that when I chose this icon file from the Properties of my Form as for Form icon in Visual Basic 2008 I get error message saying "Argument 'picture' must be a picture that can be used as a Icon". If I use same icon file from the Properties of Active X Control Button which is on excel Sheet then it works fine. I think if a icon file which can work on Visual Basic Form and as well as on Active X Control Button on an excel Sheet is the perfect icon. i tried different methods by searching on internet to create perfect 16 x 16 or 32 x 32 icon files which have no lost of colour or quality but only whith above code i get near to what i want to achive. But i cant use it for my Visual Basic application Form. I have created icon with below code which works everywhere but with below code you lose the quality and colors of the icon. I also studied "IconLib" example which you can find on internet but its to much for me. So i am kind of stuck. Is there any friend out there to help me out with some code. Dim pth As String = "C:\Document\test.gif" Dim img As New Bitmap(pth) Dim grh As Graphics = Graphics.FromImage(img) grh.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBicubic grh.DrawImage(img, 0, 0) Dim Hicon As IntPtr = img.GetHicon Dim newicon As Icon = System.Drawing.Icon.FromHandle(Hicon) Dim fpth As New IO.FileStream("C\Document\test.ico", IO.FileMode.Create) newicon.Save(fpth) newicon.Dispose() MsgBox("Image has been converted", MsgBoxStyle.Information, "Done!") Changing the file extension to ".ico" doesn't make the BMP a valid icon. You need a converter to convert images to icons. -- Garry Free usenet access at http://www.eternal-september.org ClassicVB Users Regroup! comp.lang.basic.visual.misc |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Icon Sets - Display icon in one cell depending upon value in anoth | Excel Worksheet Functions | |||
Icon Type and Name when Insert File As Icon | Excel Programming | |||
Icon on the top | Excel Programming | |||
Chalange: Creating recursive tree from Excel List | Excel Programming | |||
Icon | Excel Programming |