how to draw a bitmap transparently?

Hi,

I have an owner draw button associated with a bitmap.  In the bitmap 
editor, I turn off the option "draw opaque" for the bitmap.  That is, I 
make it transparent.  However, the the bitmap's background color still 
shows up on the button.  The bitmap has only a solid circle in the 
middle.  What else do I have to do?  Please help.  Thanks.

Tony

0
tony6018 (73)
4/20/2004 9:21:27 PM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies
1005 Views

Similar Articles

[PageSpeed] 50

One thing you can do--and this works only for some restricted cases, which you may or may
not have--is to make the button background 192,192,192, and when you LoadImage, you
specify LR_MAP3DCOLORS. It will change the 192,192,192 to whatever the user-selected color
scheme is. This is, of course, not the same as "transparent", but in some cases it is
sufficient. Otherwise, life gets tricky, and you need to look at places like
www.codeproject.com for articles on doing transparent bitmaps, or move to using GDI+.
				joe

On Tue, 20 Apr 2004 14:21:27 -0700, May Young <tony@srac.com> wrote:

>Hi,
>
>I have an owner draw button associated with a bitmap.  In the bitmap 
>editor, I turn off the option "draw opaque" for the bitmap.  That is, I 
>make it transparent.  However, the the bitmap's background color still 
>shows up on the button.  The bitmap has only a solid circle in the 
>middle.  What else do I have to do?  Please help.  Thanks.
>
>Tony

Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15972)
4/21/2004 1:21:58 AM
Reply:

Similar Artilces:

a new drawing not erase previous drawing?
visual studio c++ 6.0, mfc, graphics in my program a new drawing erases previous drawing. How to manage that all that is drawn stays alive on the window? And is not erased when the window is covered by another window, as well. And that the image does not flicker... Those last two have from time to time appeared in my attempts to solve the first problem. And that I didn't manage at all - make the first drawing, then the second, see them both at the same time on the window. I have tried the following and maybe more: Invalidate(false), InvalidateRect(false), override OnEraseBkgnd, ...

how to draw a bitmap transparently?
Hi, I have an owner draw button associated with a bitmap. In the bitmap editor, I turn off the option "draw opaque" for the bitmap. That is, I make it transparent. However, the the bitmap's background color still shows up on the button. The bitmap has only a solid circle in the middle. What else do I have to do? Please help. Thanks. Tony One thing you can do--and this works only for some restricted cases, which you may or may not have--is to make the button background 192,192,192, and when you LoadImage, you specify LR_MAP3DCOLORS. It will change the 192,192,192 to...

owner draw CListBox, how to draw "no item found"
Hello, I have an owner draw listbox, in the DrawItem I draw the items. If the listbox doesn't contain any item I would like to display a message "no item found" but this is no item, so DrawItem is the wrong place. Where should I do this? OnPaint, OnEraseBkgnd? I thought I would be able to do something like this for a test (just paint the window blue) but it's always white BOOL CmyListbox::OnEraseBkgnd(CDC* pDC) { if (m_pItemList.GetCount() < 1) { CRect rc; GetClientRect(&rc); pDC->FillSolidRect(rc,RGB(0,0,255)); return TRU...

Draw a horizontal line after the last record is printed on each pa
The details section of my report draws vertical lines which grow to accomodate text size changes. I would like to have a horizontal line drawn when last record finishes printing on the page and joins the end of the last vertical line to make a table. Please help. Thanks. -- Lydia Liu Access/VB Programmer There was at least one answer posted to your same question yesterday. -- Duane Hookom Microsoft Access MVP "Lydia" wrote: > The details section of my report draws vertical lines which grow to > accomodate text size changes. I would like to ha...

Anyone want to draw roads?
Just thought that if anyone wants to do diagrams with roads or rivers as double lines then Jeff Lanam (this n/group) kindly provided me with this link to a free programme called OCAD. Its a tiny file, is EASY to use and the results can be exported as a .bmp into Publisher. www.ocad.com I asked on this newsgroup how to achieve this and many threads resulted, so thought I'd post the solution. Many thanks Jeff (see reply to your post) Chrissss........ Glad you solved your map problem. An interesting program. -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.o...

Transparent images from publisher into pdf
When I 'set transparent colour' and make part of an image see through it looks fine in Publisher, but when I then convert the document to a pdf it doesn't carry across and the image becomes opaque again. Any ideas? I'm using Publisher Look at the options in Acrobat... Publisher 2003 does not print transparent areas http://support.microsoft.com/default.aspx?scid=kb;en-us;829174 -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "Helen1" <Helen1@discussions.microsoft.com> wrote in message news:8BE6444D-0F...

Drawing graphs on Modal dialogs
I've encounter a strange phenomenon: I have an MFC application that creates a child dialog using DoModal(). Within this child dialog I have a couple of buttons and a graph plot drawn within the area of a Cstatic using a third party API from GraphicsServer. This modal dialog has a minimize button, but when I minimize the dialog, the graph doesn't minimize with the dialog is always on top of the screen. Has anyone encountered this problem? Do you think is is a GraphicsServer issue or a Microsoft issue? I've called Graphics Server and they say that they haven't countered my proble...

Where did the drawing go?
Visio 2003 SP2 with all the latest patches. I have an extensive floor plan created in a file. I renamed the page by double-clicking on the tab and replacing the name with 'Current'. I then added a page and called it 'Proposed'. The program hour-glassed for a bit which I thought was curious and then hung. I could close the program and since I did some editing on the file, I saved it when prompted. The next time I opened the file, the design was not visible and the scale was literally off the charts (it says X = - 46 ft., Y = 89478492 ft. 6, and if I go into Page Setup a...

Selection Transparency
I just started using Excel 2007, and I am having trouble actually seeing the range of cells that I am selecting when I click and drag my mouse. Does anyone know if there is a way to make the selection darker and more visible like in Excel 2003? I have searched the options and menus and can't find anything in Excel, so maybe this is a Vista problem. Thanks There is no way to adjust the color for the highlighted cells. However if you are having difficulty, try adjusting the brightness and contrast of your monitor to a level in which you are comfortable. If you are using an LCD M...

How to draw text always visible
Hi NG, I Have program which is drawing objects(PIPES)using the OPENGL. The labels for the for the PIPE is drawing using the GDI. The text colour for the labels is same that of the objects. The labels are usually positioned at out side of the pipe so that it will be visible always. But while rotating there are possibilities that the labels and objects coincide. I want to set the labels always visible with respect to the back ground colour. I used SetRop2() but it has no effect. Any help would be greatly appreciated Best regards Raghuram.k ...

Putting Bitmap into a Dialog Picture Control
I am trying to use a Picture Control (from the dialog editor) to display various bitmaps as my program is running. The general approach is to get the control (pWindow), load a bitmap from a resource (pBitmap) and call my DrawBitmap function. Everything appears to work well but no bitmap is drawn. BTW, my Picture Control is of type "Frame" and it is visible. As an aside, I don't seem to be able to find much documentation on Picture Control. Thanks in advance for any suggestions. I would definitely consider another approach if this is doing it the hard way. Bob Curry void...

Owner draw main windows, will left some drawing on the background of the window, I want the reason and how to prevent this happen? 01-05-10
Hi, Everyone! Ownerdraw main window , I used SetWindowRgn to cut down the four corners, but there will left something drawing here when you drag the corners and borders to resized the window on the background of the main window. Only 3 corners of the four corners do this. I used HDC hWindowDC = GetWindowDC(); Draw the non client area on hWindowDC In class of WTL: class CMainFrame : public CFrameWindowImpl<CMainFrame>, public CUpdateUI<CMainFrame>, public CMessageFilter, public CIdleHandler Thanks a lot! Have a Happy New Year! begin 666 problem.JPG ...

How Draw a chart showing the following function: y=sin(x)
Can someone explain me how can i make this chart i excel? Remember i don't want use function to count! I want draw! Thanks for hel -- Pusie ----------------------------------------------------------------------- PusieK's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1621 View this thread: http://www.excelforum.com/showthread.php?threadid=27630 For a variety of approaches adapt the ideas at Normal curve http://www.tushar-mehta.com/excel/charts/normal_distribution/index.htm particularly the three sections: Enumerating a set of points in a worksheet Using...

Controlling drawings (a CM problem)
Can you save me the trouble? I'm looking for a cheap and easy tool to support the control of drawings (which in fact are currently Word documents) that describe hardware components and how they build up through sub-assemblies into assemblies and systems. It needs some version control at the drawing level, and a baselining function. I know we could do it with something like Dimensions, or maybe even ClearCase, but they're too big and expensive. If necessary. I'll write something myself in Access, but before I do, is there anything out there (freeware, shareware?) that migh...

radar chart
i am trying to do a radar chart of activities of my organization in comparison to other organizations. as a result, i have stacked filled in areas, however i am not able to make them transparent so as to see the area under the one that is on top. There is a tab for "Transparency" under "Patterns" - "Fill Effects" when I double click on an area i want to make transparent, but I cannot make it work. The transparency tab remains unresponsive. Anybody have any advice? Thanks. 1. Buy a Mac (ugh!) 2. Apply some trig to adapt these techniques to a radar chart: ...

create a bitmap from an intptr to scanned data
Hi All I have successfully retreived a pointer to scanned image data but all efforts to turn this data into a bitmap have failed. Can anybody help? Thanks Mickey On 12/20/2009 12:29 PM, mickey wrote: > Hi All > I have successfully retreived a pointer to scanned image data but all > efforts to turn this data into a bitmap have failed. Can anybody help? > > Thanks > Mickey A pointer? That isn't likely. You would need the actual image data. If it really is a handle to a GDI+ bitmap, then look at Image.FromHBitmap(handle as IntPtr). -- Mike ...

How custam draw separator in custom draw menu
Good morning! I was obtain menu from handle and its submenu CMenu* mmenu = CMenu::FromHandle(m_hMyMenu); CMyMenu* submenu = (CMyMenu*)mmenu->GetSubMenu(1); ^^^^^^^^^ I was set that a item ID_FILE_NEW has flag MFT_OWNERDRAW MENUITEMINFO m_MenuItemInfo; m_MenuItemInfo.cbSize = sizeof (MENUITEMINFO); m_MenuItemInfo.fMask = MIIM_FTYPE; submenu->GetMenuItemInfo(ID_FILE_NEW,&m_MenuItemInfo); m_MenuItemInfo.fType |= MFT_OWNERDRAW; submenu->SetMenuItemInfo(ID_FILE_NEW,&m_MenuItemInfo); In function "void CMyMenu::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)" I w...

CTreeCtrl and custom draw
OK, so having given up on SetIndent() I'm having a look at custom draw ... The problem: Display a tree control with a long thing graphic for each item (say, 48 pixels wide, normal tree item height) plus text. I've read lots of articles on custom draw but nobody seems to do anything directly relevant. I seem to have discovered: (1) The only way to get the boxes and lines drawn for you (I have no reason to want to do these myself!) is to let CDDS_ITEMPREPAINT do its default drawing and tell it you want CDRF_NOTIFYPOSTPAINT and draw the item in CDDS_ITEMPOSTPAINT. (2) To avoid wasti...

drawing graph of function
How can I draw a graph of a function without first making a table? S can I make a graph by just giving the function -- wim rademaker ----------------------------------------------------------------------- wim rademakers's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=3013 View this thread: http://www.excelforum.com/showthread.php?threadid=49831 wim rademakers wrote: > How can I draw a graph of a function without first making a table? So > can I make a graph by just giving the function? > > ------------ Make a table. Bill Hi, Hi are a few exam...

Drawings
Is visio good/detailed enough to draw a floor plans of a corporation? If not what do you recommend On Thu, 16 Oct 2008 08:28:48 -0700, Visio beginner <Visiobeginner@discussions.microsoft.com> wrote: >Is visio good/detailed enough to draw a floor plans of a corporation? Yes. -- Regards, Paul Herber, Sandrila Ltd. Bow tie for Visio http://www.visio-bowtie.sandrila.co.uk/ ...

Transparent TIFF Publisher 2007
How do you get Publisher 2007 to accept a transparent TIFF ? Rather than dispaly the transparent background it defaults to an opaque white one ? VistaTest wrote: > How do you get Publisher 2007 to accept a transparent TIFF ? Rather > than dispaly the transparent background it defaults to an opaque white > one ? I don't think Publisher supports TIFF transparency. It MIGHT transfer properly to a PDF, but I doubt it. Publisher does support PNG transparency. -- Ed Bennett - MVP Microsoft Publisher http://ed.mvps.org VistaTest wrote: > How do you get Publisher 2007 to accept...

Drawing in a View
Hi, I have a view which show a map of a city centre in which I display some icons to represent certain places of interest. I need to be able to have some sort of rectangular box away from each icon which has information regarding each place of interest. I am thinking of something like a messagebox like below ------------------ | | | INFO | | | ------------------ | | | | | | | | ...

how can I call the default drawing in owner draw
I have a CTabCtrl and want to do owner draw on it. But I just want to owner draw a part of the CTabCtrl, i.e. I just want to remove the bottom border edge of CTabCtrl, and I want the other part of CTabCtrl untouched. But how can I write the code to let other part(tab, left/right border) draw themselves same as MS do? Can MS let us call the default drawing functions of CTabCtrl? ...

transparencies are printing opaque instead of transparent
All shadows and pictures set on color transparent, transparent gradient, or a certain percentage transparent, are printing opaque instead of transparent. It shows up transparent on the file when I set it, but shows opaque in the print preview mode, and then prints opaque as well. ...

How to draw line between to boxes
I am very new to Visio. I am trying to draw a flow chart. I have drawn the boxes and now I want to connect them by lines. There is an "Arrow" tab in left side pane for shpaes but it seams that it is something different. Where is the draw line command? -- Rasoul Khoshravan Azar Civil Engineer Osaka, Japan On Mon, 27 Mar 2006 16:37:01 -0800, Khoshravan <khoshravan@discussions.microsoft.com> wrote: >I am very new to Visio. I am trying to draw a flow chart. I have drawn the >boxes and now I want to connect them by lines. There is an "Arrow" tab in >left s...