MFC Transparent CDialog Demo

Environment: Visual C++ V6.0

This dialog is derived from CDialog. A bitmap is loaded from a file and a region created based on a transparent colour. The bitmap is then used to paint the dialog. This demo also demonstrates dragging the dialog by clicking anywhere on a visible portion of the dialog, timer events, and a button on the transparent dialog.

It is perfect to be used as a splash screen or similar application or as a skeleton application for non-rectangular windows that are shaped by a supplied bitmap.

Downloads

Download demo project - 87KB


Comments

  • Thanks!

    Posted by stahl on 08/04/2008 04:00pm

    Works great, exactly what i was looking for!

    Reply
  • Do add the important code in the page rather than ziping .

    Posted by jayender.vs on 11/24/2005 01:36am

    Please add the important codes in the displayed page rather than putting it into zip file. Many have the restriction in downloading the zip file.

    Reply
  • Extra code.

    Posted by Legacy on 12/17/2002 12:00am

    Originally posted by: John Wellbelove

    I was playing around with the code and background bitmaps and came up with this small addition. It adds the region of the 'close' button to the window region, making it always visible regardless of the bitmap transparency. You can make some wild dialogs with this, such as a group of controls that float on the desktop without any apparent (connected) dialog background.

    Add this after the bitmap region is created.

    CWnd *pWnd = GetDlgItem(IDC_CLOSE);
    CRect rect;
    pWnd->GetWindowRect(&rect);
    ScreenToClient(&rect);
    crRgnTmp.CreateRectRgn(rect.left, rect.top, rect.right, rect.bottom);
    crRgn.CombineRgn(&crRgn, &crRgnTmp, RGN_OR);
    crRgnTmp.DeleteObject();

    Reply
  • Not working with Windows 98

    Posted by Legacy on 12/11/2002 12:00am

    Originally posted by: Richard Adams

    For some reason the dialog controls are all offset on Windows 98? Ideas?

    Reply
  • Disappearing dialog

    Posted by Legacy on 12/10/2002 12:00am

    Originally posted by: John Wellbelove

    I found that sometimes, if you drag and drop the dialog lots of times, it may suddenly close for no apparent reason!

    System
    XP SP1
    VC++ 6.0 Standard.

    Reply
  • Not working

    Posted by Legacy on 12/09/2002 12:00am

    Originally posted by: gerlinden

    Your demo is not working. Where is the bitmap?
    .DoModal returns "Error Loading bitmap"

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Java developers know that testing code changes can be a huge pain, and waiting for an application to redeploy after a code fix can take an eternity. Wouldn't it be great if you could see your code changes immediately, fine-tune, debug, explore and deploy code without waiting for ages? In this white paper, find out how that's possible with a Java plugin that drastically changes the way you develop, test and run Java applications. Discover the advantages of this plugin, and the changes you can expect to see …

  • Live Event Date: September 17, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT Another day, another end-of-support deadline. You've heard enough about the hazards of not migrating to Windows Server 2008 or 2012. What you may not know is that there's plenty in it for you and your business, like increased automation and performance, time-saving technical features, and a lower total cost of ownership. Check out this upcoming eSeminar and join Rich Holmes, Pomeroy's practice director of virtualization, as he discusses the …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds