Solved

How do I make my Picture control bitmap TRANSPARENT?

Posted on 1997-05-25
4
443 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

743 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

12 Experts available now in Live!

Get 1:1 Help Now