Howto draw CImageList using alpha channel (repost)

I am desperately trying to draw images from an imagelist to the screen,
using the alpha channel to blend nicely into the background. Alas, I give
up, I am totally confused with all the flags and options, having tried out
probably all the possible combinations except the one that works :-)

Here's my (abbreviated) code:

---------
CImageList myImageList;
myImageList.Create (24,24,ILC_COLOR32,0,1);

CBitmap myBitmap;
myBitmap.LoadBitmap (IDB_MYBITMAP);

myImageList.Add (&myBitmap, RGB(255,0,255));

CDC dc;
dc.Attach (lpDrawItemStruct->hDC);    // this comes from the caller

myImageList.DrawIndirect (&dc,0, CPoint(0,0), CSize(0,0), CPoint(0,0),
    ILD_PRESERVEALPHA, 0,
    RGB(255,0,0), RGB(0,0,255),
    ILS_ALPHA, 255,
    CLR_DEFAULT);
-------------

This draws the bitmap nicely, it even seems to blend, but the background is
pitch black.

Any ideas how I could draw the bitmap, recognizing the alpha channel, using
the nice grey background? Any pointers to samples are most welcome.

I am using VS2003 under WinXP. Alpha channel recognition works because I
also draw blending buttons on the toolbar successfully.

TIA
Rudi




0
rudolf1 (4)
9/30/2003 7:50:47 AM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies
1525 Views

Similar Articles

[PageSpeed] 24

Did you have Common Controls 6 manifest file (or resource) in your
application? Only "manifest'ed" XP/2003 apps can use Image Lists with alpha
channel.
The WTL library version 7.0 has Alpha sample application with alpha-blended
toolbars.

--
WBR, Vitaly Brusentsev,
AWinstall development team.
http://www.awinstall.com    mailto:vb@awinstall.com

"Rudolf Wiener" <rudolf@nospam.wiener.at> wrote in message
news:ONEYteyhDHA.2884@tk2msftngp13.phx.gbl...
> I am desperately trying to draw images from an imagelist to the screen,
> using the alpha channel to blend nicely into the background. Alas, I give
> up, I am totally confused with all the flags and options, having tried out
> probably all the possible combinations except the one that works :-)
>
> Here's my (abbreviated) code:
>
> ---------
> CImageList myImageList;
> myImageList.Create (24,24,ILC_COLOR32,0,1);
>
> CBitmap myBitmap;
> myBitmap.LoadBitmap (IDB_MYBITMAP);
>
> myImageList.Add (&myBitmap, RGB(255,0,255));
>
> CDC dc;
> dc.Attach (lpDrawItemStruct->hDC);    // this comes from the caller
>
> myImageList.DrawIndirect (&dc,0, CPoint(0,0), CSize(0,0), CPoint(0,0),
>     ILD_PRESERVEALPHA, 0,
>     RGB(255,0,0), RGB(0,0,255),
>     ILS_ALPHA, 255,
>     CLR_DEFAULT);
> -------------
>
> This draws the bitmap nicely, it even seems to blend, but the background
is
> pitch black.
>
> Any ideas how I could draw the bitmap, recognizing the alpha channel,
using
> the nice grey background? Any pointers to samples are most welcome.
>
> I am using VS2003 under WinXP. Alpha channel recognition works because I
> also draw blending buttons on the toolbar successfully.
>
> TIA
> Rudi
>
>
>
>


0
vb3685 (19)
10/4/2003 7:25:50 PM
Reply:

Similar Artilces:

Accruing Use Tax
Hello, We have an issue where we would like to use tax schedule ID's to accrue use tax that does not show up on the vendors invoice. Lately, we've been manually entereing a line in the GL distribution to accure. I've tried using the tax schedules, but they want to add the tax amount to the total invoice amount--which is not what we want. Has anyone else ran into these issues?? Yes and we covered it in our book Confessions of a Dynamics GP Consultant. Here is one way to do this.... Create a special "Credit Card" for the tax man. Now enter the payables voucher...

Commandbar not getting added to inspector when word is used as editor
Hi, I have written a Com Add-in which adds a new Commandbar to the New Mai window. I am using the NewInspector event to place a Commandbar wit buttons on a new mail Inspector window , I.e. Whenever New Mail messag window is opened. I have created a new commandbar and aded a ne commandbutton on that newly created commandbar. Everything is working fine if i use HTML as mail editor. If i use wor as the default mail editor in outlook, then the commandbar is no getting added and also the buttons. Could someone please suggest me what i should do to add the commandbar to the word mail editor when ...

repost help windows error
I have uninstalled reinstalled three times - different directories - complete shutdown and restarts to no avail --------------------------- Microsoft Visual C++ Runtime Library --------------------------- Runtime Error! Program: C:\Program Files\Microsoft Money\System\msmoney.exe abnormal program termination --------------------------- OK --------------------------- You can keep posting at 12 hour intervals and it will not make anybody more likely to know an answer to your issue. Note also that neither of your posts ever pose a question. This is not a common issue with a simple ans...

Move and reset valuse using a command Button
Can I use a command Button to move cell valuse from one cell to another. I then want to reset a 3rd cell to 0. I have a spread sheet that I use to work out how much fuel I have used each day. I input what I have left for the day in one cell and yesterday volume in another. I would like to be able to use a command button to transfer "todays" figure to "yesterdays" and then reset the "used" cell to "0" when I open the sheet the next day. Therefore I would only having to input todays figure. What would be the best way for this. 30/12/0...

Style Separator Used in a Frame (MS Word 2007)
Hello, I'm using MS Word 2007 on a PC with Windows XP. Here is my issue: I am putting a figure and caption in a frame, but i don't want the entire caption to show up in my table of figures. For example, I have a caption like: Figure 2.1: Exploding Foil Initiator: (a) Overall; (b) Free-body diagram I don't want the entire caption ": (a) Overall; (b) Free-body diagram" to show up in my table of figures; therefore, I tried to use a style separator and I have: Figure 2.1: Exploding Foil Initiator % : (a) Overall; (b) Free-body diagram where "%&...

This message uses a character set.....?
Some users have been complaining about this e-mail. I have no idea what it means but every once in a while, someone in the office will get this. This message uses a character set that is not supported by the Internet Service. To view the original message content, open the attached message. If the text doesn't display correctly, save the attachment to disk, and then open it using a viewer that can display the original character set. Any help is appreciated. It means exactly what it says. You dont have the correct character sets installed to view the message ( it could be in Chinese ...

300 Locations+ using RMS?
Does anyone out there have 300-400 locations operating on RMS? Is this even possible. Currently we have 80 with a projected 150 next year and 200 following. Within 5-10 years we will hit 500-1,000. Can RMS support a company of our size? Has anyone pushed the system to this level? -- Jocelyn wow :) Is there a HQ Dongle with license up to 1000+ locations...your company is rocketing :) Is your company in fashion retail ?Food? Your implementation is quite big. how was the performance of RMS hitting 80 locations? Are you using HQ (I suppose you do.)? how's the speed in terms of conne...

How do I insert a radio button using Excel 2007?
How do I insert a 2 radio button group using Excel 2007 and of course how do i program them? thank you in advance. The following code will create a Frame and two Option Buttons at cell C3. Change the various Top and Left properties to get them positioned as you want. Sub AAA() Dim FRA As OLEObject Dim BTN1 As OLEObject Dim BTN2 As OLEObject Dim WS As Worksheet Dim TopLeftCell As Range Dim VBComp As VBIDE.VBComponent Dim CodeMod As VBIDE.CodeModule Dim N As Long Set WS = Worksheets("Sheet1") Set TopLeftCell = WS.Rang...

Mail Merge using Named Range in Excel
Having trouble completing a mail merge in Word using an Excel spreadsheet. In the spreadsheet there are named ranges, I have included the column headings by defining the range that is non-contiguous (not next to each other). When I go to complete the merge, the range will not show up as an option to use. If I re-define the range to not include the column headings and the range is a block of cells next to each other, the merge still doesn't work correctly, it assumes the merge assumes the row above the range is the column heading row (i.e. range is A16:J101, it uses row 17 as the column ...

How do I use auto fill to add information from an existing source?
I am trying to figure out how to use some type of auto fill. What I have to do is put in a customer name and then I need to have the address, city, state, zip and phone number automatically fill in. How would I do that? Assume Sheet2's cols A to F is the existing reference, where col A contains the names, cols B to F contain the other info, eg: address, city, state, zip and phone number In Sheet1, you have the names listed in A2 down Put in B2: =IF($A2="","",VLOOKUP($A2,Sheet2!$A:$F,COLUMNS($A:A)+1,0)) Copy B2 across to F2, fill down as far as required -- Max ...

My Office application cannot start because Office is already being used
Operating System: Mac OS X 10.5 (Leopard) Processor: Intel My Office application cannot start because Office is already being used. I used a pendrive to transfer an old Word file from my old System 9 iMac to print it through my MacBook Pro. Usually no problem doing this - but suddenly i get this message. Obviously each computer has its own independently installed MS Office (by dealer) - so what's up? On 7/15/08 11:42 PM, in article 59b544b3.-1@webcrossing.caR9absDaxw, "dalfam@officeformac.com" <dalfam@officeformac.com> wrote: > Operating System: Mac OS X 10.5 (Leopar...

Having Formatting Remain on "Called" cell using IF function
I'm using an IF function to call some other cells, but I want to have the various words color coded, eg ("Certified" is green, "Recertify" is yellow, and "Not Certified" is red). I have the IF function working correctly, but when it "calls" the cell to have it display the appropriate word, the color of each word is not brought along with it...only the text. Is there a way to be able to color code it so that the appropriate color appears? Thanks! -- Zaraf ------------------------------------------------------------------------ Zaraf's Profi...

"Theme" and "recently used" font list
How do I change the "theme" and "recently used" font list? "WD2000: How to Turn off the Font Most Recently Used (MRU) List" at http://support.microsoft.com/?kbid=199785; for Word 2002, see http://support.microsoft.com/?kbid=289506; for Word 2003, see http://support.microsoft.com/?kbid=820917. -- <>>< ><<> ><<> <>>< ><<> <>>< <>><<> Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org <>>< ><<> &g...

Using Pivot Table with VLookup
Folks, I have two sets of Data sitting in two separate worksheets. For the purposes of my reconciliation work, I need to compare the sets with one another. For example, Set 1 has the following 3 fields(and accompanying information): Name Ticket # Fare Johnson/F 1692742117 2075.23 Johnson/F 1692742117 (2,075.23) PMT/ON 5027246983 67,851.36 PMT/ON 5027246983 (67,851.36) Singh/F 1698798564 3250.36 Mirer/G 9707266335 542.36 Mirer/G 9707266335 (542.36) Set 2 has the following information: Name Ticket # ...

How to get query to return total using wildcard
I have a query that has 3 criterion in it as follows: Business Unit, Location, Category. These criterion are all chosen by the user on a loaded form. Currently the results then are based on what is chosen from a drop down list for each of the 3 criterion. The user also wants a total option. Meaning if Business Unit is chosen, and Location and Category are not chosen (or if a wildcard is chosen) the result returns a total based on that Business Unit. How do I write this in the query? You have to use a union query, one part for details and the other for the totals. Use cri...

draw a horizontal line at the end of report
My report draws vertical lines in details section. How can I draw a horizontal line after last record on each page to make the table complete? Thanks. -- Lydia Liu Access/VB Programmer Have you tried adding a horizontal line in the Page Footer? -- Duane Hookom Microsoft Access MVP "Lydia" wrote: > My report draws vertical lines in details section. How can I draw a > horizontal line after last record on each page to make the table complete? > Thanks. > > -- > Lydia Liu > Access/VB Programmer > ...

PUB locked and in use ???
We are running a LAN, one computer keeps leaving pub files locked. No security is on, we have rebooted, etc. I can make a copy thru Windows Explorer and use it. Any ideas? You found your own solution. Publisher is not a happy camper on a network. Copy the file, edit it, save to your local driver, copy to the network. -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "NAfix" <NAfix@discussions.microsoft.com> wrote in message news:5FC16D13-A3EA-4481-92EA-0DF7BFDEFE25@microsoft.com... > We are running a LAN, one ...

Can the Outlook Connector be used with a gmail or ymail account?
I have a problem with send/receive in Outlook 2003 with my gmail account. I posted about that issue on January 2, and the problem has not yet been resolved. Outlook at that time started doing the send/receive with gmail very slowly, and then gets hung up before finishing the send/receive. I have since that time heard of the Outlook Connector for hotmail accounts, and am wondering if that can be used with gmail, and if that might be a possible solution to my problem. Can the Outlook Connector be used with gmail? Thanks, Larry No. -- Milly Staples [MVP - Outlook] ...

Listing 'last used' date
Hi folks. We have literally hundreds of databases and my boss wants me to try and produce a listing where we can idenatify the tables etc., and link a 'last used' date, in order to delete those that are no longer used. Has anyone any ideas about how to go about this? Mike MacKinnon wrote: > Hi folks. We have literally hundreds of databases and my boss wants > me to try and produce a listing where we can idenatify the tables > etc., and link a 'last used' date, in order to delete those that are > no longer used. > > Has anyone any ideas about how to go abou...

How to create a signature using css
Basic inline css works, but does anyone know the code to included a background picture? ...

How do I use overtype in Publisher?
I can use overtype in Word and Excel but I can't seem to figure out how to turn it on in Publisher. Is it even possible to do this? ...

Using VC++ 6.0 under Vista
Hi All, I was wondering if anyone has any experience to share, successful or unsuccessful, using VC++ 6.0 under Vista. I know it isn't supported but we may have to do it anyway. Googling has yielded some references to issues installing it, but not much about using it to compile and/ or to debug. Wondering how feasible it is and if there are any gotchas. Thanks! Sherri ranin02 wrote: > Hi All, > > I was wondering if anyone has any experience to share, successful or > unsuccessful, using VC++ 6.0 under Vista. I know it isn't supported > but we may have to do it a...

Entering Password using Inputbox
Hi all, I use an Inputbox VB script to enter a password on my form. I'd like when user enter the password, only '*' comes up on the screen so nobody can see it. Is anyone have an idea how to do that using InputBox statement? Thanks in Advance. KT -- Message posted via http://www.accessmonster.com The InputBox doesn't have that capability. Take a look at my March, 2005 "Access Answers" column in Pinnacle Publication's "Smart Access". You can download the column (and sample database) for free at http://www.accessmvp.com/djsteele/smartaccess.html...

Using custom variables in receipts
Does anyone know how to assign or reassign values to custom variables conditionaly in receipts. I am trying to assign values to variables based on the certain department sales so that i can use them in calculations doing receipt processing(x, z, zz). <!-- Test Code to generate department values for custom entries on the report --> <FOR each = "ReportDepartment"> <!-- <ROW> Report.Department.Name "|" Report.Department.Sales "|" Report.Department.PercentageSales </ROW> --> <IF><condi...

Exchange uses A-record if there is no answer from the DNS
Earlier I asked a question concerning sending by the Exchange server of mail not on -record of the domain, and on -recording. The answer essentially was not Now I managed to receive a log from the dnsdiag-utility which shows, that all over again the information on -recording has not been obtained, and at secondary search - the normal information is obtained On a SMTP-log I see, that at absence of the data on -record and at presence in DNS cache of the information on -recording, the Exchange server tries to send a mail on this -recording Whether it is possible to force the server with the he...