473,545 Members | 1,938 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problems converting icons to IPictureDisp

Greetings,

I am converting an old VB6 application to use .NET. One of the old controls
loads icons from the disk and displays them. However, the transparent color
turns to blue somewhere in the process. I narrowed it down to the conversion
to IPictureDisp by first loading and saving the icon as a bitmap with no
problems; and then repeating the process but adding the step of converting
to an IPictureDisp as well. The first operation worked fine, the second
resulted in an icon with a blue background. My question: How can I preserve
the transparent color of the original icon while still converting to an
IPictureDisp?

Here's the code:

'As a first step, just load and save the icon as a standard
System.Drawing. Bitmap. Works fine and the icon looks unchanged.
Dim fileImage = New System.Drawing. Bitmap(g_strIco nPath & strIcon)

fileImage.Save( g_strToolbarIco nPath & "test.bmp")

'Now save it again, but first convert the image to an IPictureDisp and then
back again. Now we have a blue background!!

fileImage = VB6.IPictureDis pToImage(VB6.Im ageToIPictureDi sp(fileImage))

fileImage.Save( g_strIconPath & "test2.bmp" )

Any help greatly appreciated!

Thanks,

Cary


Nov 21 '05 #1
2 6163

Map Reader wrote:
Greetings,

I am converting an old VB6 application to use .NET.

[and problems are happening with IPictureDisp]

Sorry, I don't have an actual answer, but only a suggestion that since
you are converting away from VB6 then perhaps you would consider using
Framework functionality rather than COM functionality such as
IPictureDisp to do whatever it is you want to do?

--
Larry Lard
Replies to group please

Nov 21 '05 #2
I have tried to find a way to convert a bitmap to an icon while preserving
the transparent color in the bitmap (spent two weekends on this) but
failed...good luck. I think you have to get into the API and use CreateIcon
but will need to know the transparent color first.
--
Dennis in Houston
"Map Reader" wrote:
Greetings,

I am converting an old VB6 application to use .NET. One of the old controls
loads icons from the disk and displays them. However, the transparent color
turns to blue somewhere in the process. I narrowed it down to the conversion
to IPictureDisp by first loading and saving the icon as a bitmap with no
problems; and then repeating the process but adding the step of converting
to an IPictureDisp as well. The first operation worked fine, the second
resulted in an icon with a blue background. My question: How can I preserve
the transparent color of the original icon while still converting to an
IPictureDisp?

Here's the code:

'As a first step, just load and save the icon as a standard
System.Drawing. Bitmap. Works fine and the icon looks unchanged.
Dim fileImage = New System.Drawing. Bitmap(g_strIco nPath & strIcon)

fileImage.Save( g_strToolbarIco nPath & "test.bmp")

'Now save it again, but first convert the image to an IPictureDisp and then
back again. Now we have a blue background!!

fileImage = VB6.IPictureDis pToImage(VB6.Im ageToIPictureDi sp(fileImage))

fileImage.Save( g_strIconPath & "test2.bmp" )

Any help greatly appreciated!

Thanks,

Cary


Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
6403
by: john | last post by:
I'm working on an add-in and one of the methods in the extensibility model takes an object of type IPictureDisp. How can i get this in .Net? I've tried loading up bitmap, image and icon classes, and use those, but they dont impelemt this interface. has any one played with IPictureDisp in C#? thanks, John
0
2305
by: Shao | last post by:
I am using VS.Net 2003 and I need to create a IPictureDisp pointer that points to a picture object. IPictureDisp *pd; PICTDESC pdesc; memset(&pdesc,0,sizeof(pdesc)); pdesc.cbSizeofstruct = sizeof(pdesc); pdesc.picType = PICTYPE_BITMAP; pdesc.bmp.hbitmap = static_cast
2
3312
by: Stephen Turner | last post by:
Hi, I have implemented a COM object in .NET, and I simply want to load an icon resource and pass back an IPictureDisp to clients. What is the esiest way to do this? I had used LoadResPicture in VB, but I havent been able to create/load an icon resource in VB .NET. I'm sure that this should be simple....by so far I am failing miserably!...
3
1965
by: Dinesh Jain | last post by:
Hi All, I am developing an application under Framework 1.0 and really getting unsolvalble problems- 1. System.ExecutionEngineException in Unknown module: Occurs sometimes not frequent. (Might be Marshalling problems - read from MSDN)
0
2827
by: Andre Viens | last post by:
Hello, I am using the following variation of code from <http://support.microsoft.com/default.aspx?scid=kb;EN-US;319340> to add icons to an imagelist for use in a listview: Private Structure SHFILEINFO Public hIcon As IntPtr ' : icon Public iIcon As Integer ' : icondex Public dwAttributes As Integer ' : SFGAO_ flags
1
1439
by: Zubair.NET! | last post by:
Hi, I am in a situation where I need to upload different File Types in an application, and based on their MIME-Type, I need to show their respective icons. The question is: Does anyone know how to read Windows Icons (.ico) from ASP.NET based on their MIME-Type and convert them to (.gif) I need a urgent answer to this. Thanks in...
1
4295
by: Rad Daddy | last post by:
A friend gave me a copy of an access database he was working on a few years back. Its similar to what I want to design so I'm using is as a starting point. Problem is, he used some need images on many of his command buttons. They are embedded in the database. On the properties window, it tells me where they were originally located on the hard...
1
6204
by: =?Utf-8?B?WWFlbA==?= | last post by:
Hi, I have problem is with return stdole.IPictureDisp in this method if the computer don't have vs.net installed. I created a com add-in for outlook 2003 in vs.net 2003 c#. if I calling stdole.IPictureDisp Pic = MatarotHost.ImageToIPicture(Image.FromStream(imgStreamPic)); And I don't have a vs.net installed in a computer: I don't get...
0
1840
by: =?Utf-8?B?WWFlbA==?= | last post by:
I created a com add-in for outlook 2003 in vs.net 2003 c#. My problem is with return type stdole.IPictureDisp. if I calling stdole.IPictureDisp Pic = MatarotHost.ImageToIPicture(Image.FromStream(imgStreamPic)); And I don't have a vs.net installed in a computer: I don't get errors, but I can't see the button add-in The add-in not arrive to...
0
7467
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7807
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7756
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5326
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4944
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3450
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3442
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1879
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1014
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.