Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 460
  • Last Modified:

How do I make my Picture control bitmap TRANSPARENT?

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
wagtail
Asked:
wagtail
  • 2
1 Solution
 
laleonardCommented:
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
 
wagtailAuthor Commented:
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
 
AVaulinCommented:
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
 
wagtailAuthor Commented:
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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now