473,480 Members | 1,663 Online
Bytes | Software Development & Data Engineering Community
Create 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_strIconPath & strIcon)

fileImage.Save(g_strToolbarIconPath & "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.IPictureDispToImage(VB6.ImageToIPictureDisp(fi leImage))

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

Any help greatly appreciated!

Thanks,

Cary


Nov 21 '05 #1
2 6152

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_strIconPath & strIcon)

fileImage.Save(g_strToolbarIconPath & "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.IPictureDispToImage(VB6.ImageToIPictureDisp(fi leImage))

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
6391
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,...
0
2302
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 =...
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...
3
1961
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....
0
2817
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...
1
1438
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...
1
4271
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...
1
6193
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...
0
1830
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 =...
0
6904
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7076
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...
1
6732
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
6886
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...
0
5324
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4768
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...
0
4472
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...
0
2990
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...
0
1294
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 ...

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.