Solved

How do I make my Picture control bitmap TRANSPARENT?

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Grammars for C C++ and java 1 138
passing data from one form to another form in c++ 27 87
draw a Christmas tree by using a nested loop? 26 88
GET error with Font Awesome 3 28
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
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.

679 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