473,372 Members | 1,146 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,372 software developers and data experts.

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 6142

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
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
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
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
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
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
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
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
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
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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.