Solved

How do I make my Picture control bitmap TRANSPARENT?

Posted on 1997-05-25
4
446 Views
Last Modified: 2013-12-03
Hi,

How do I make part(s) of my Picture control bitmap transparent?

It's positioned on top of a dialog box in a Windows '95 app.

I have tried setting the background colour to be the same as
the parts of the bitmap I want to be transparent (in MSVC++
Graphics editor), and setting the control's "transparent"
extended style, but the whole image stays resolutely opaque...

I don't know if it's relevant or not, but there is a static
(opaque) text control sitting on top of the picture control as
well. However, this only obscures a small part of the picture
control and doesn't cover the bits I want to be transparent.

Anyone?
0
Comment
Question by:wagtail
  • 2
4 Comments
 

Expert Comment

by:laleonard
ID: 1163698
I assume you want to make it transparent so that a control (say, a pushbutton) will show though...  if not, you might send us a snippet of the DIALOG code from the RC file...In the Graphics Editor, select the "Layout, Tab Order" menu item, and make sure that the picture control has a lower number than the (say, pushbutton) control that you're try to "reveal".  Also, be sure the picture control does *not* have the transparent style set.
0
 

Author Comment

by:wagtail
ID: 1163699
Hi laleonard,

Thanks for your reply.

Basically I have a bitmap which is non-rectangular in shape. There aren't any controls behind it to show through, just the plain background colour of the dialog itself.

I want to make sure that the bits around the edges of my bitmap are transparent, eg they show up as the same colour as the user's dialog background (whatever that might be).

All the "cutaway" bits of the bitmap are set to the same colour - I thought it was just a matter of making this the background colour in Graphics Editor, but I was wrong!

Here's the snippet from the RC file. I presume the picture control is the one right at the end of the list...

IDD_SAVER_DIALOG DIALOG DISCARDABLE  0, 0, 248, 210
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Saver Config"
FONT 8, "MS Sans Serif"
BEGIN
    GROUPBOX        "Pen",IDC_STATIC,5,6,113,70
    LTEXT           "Width",IDC_STATIC,11,22,30,8
    EDITTEXT        IDC_EDIT_WIDTH,51,20,40,13,ES_AUTOHSCROLL
    LTEXT           "End Style",IDC_STATIC,11,40,36,8
    COMBOBOX        IDC_CAP_STYLE,51,38,61,41,CBS_DROPDOWNLIST | WS_VSCROLL |
                    WS_TABSTOP
    GROUPBOX        "Resolution",IDC_STATIC,5,79,113,40
    LTEXT           "Low",IDC_STATIC,14,92,30,8
    RTEXT           "High",IDC_STATIC,77,92,30,8
    SCROLLBAR       IDC_SCROLLBAR_RES,14,103,94,11,WS_GROUP | WS_TABSTOP
    GROUPBOX        "Speed",IDC_STATIC,5,121,113,40
    LTEXT           "Slow",IDC_STATIC,14,134,30,8
    RTEXT           "Fast",IDC_STATIC,77,134,30,8
    SCROLLBAR       IDC_SCROLLBAR_SPEED,14,145,94,11,WS_GROUP | WS_TABSTOP
    DEFPUSHBUTTON   "OK",IDOK,137,14,50,14
    PUSHBUTTON      "Cancel",IDCANCEL,137,31,50,14
    CONTROL         "",IDC_PREVIEW,"Static",SS_SIMPLE,134,83,76,56
    PUSHBUTTON      "Color...",IDC_BUTTON_COLOR,137,49,50,14
    LTEXT           "Join Style",IDC_STATIC,11,58,36,8
    COMBOBOX        IDC_JOIN_STYLE,51,56,61,41,CBS_DROPDOWNLIST | WS_VSCROLL |
                    WS_TABSTOP
    CONTROL         136,IDC_STATIC,"Static",SS_BITMAP,126,74,18,20
END
0
 
LVL 4

Accepted Solution

by:
AVaulin earned 50 total points
ID: 1163700
How about this way: use AVI which suuport transparent background instead bitmap. CAnimateCtrl class give possibilities to work with AVI. I hope it can help.
0
 

Author Comment

by:wagtail
ID: 1163701
Thanks AVaulin,

You got me moving again. I looked at CAnimateCtrl then decided to go for CImageList which allowed me to do it without creating a .AVI.

Cheers,

   Gil

0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now