• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 466
  • Last Modified:

DWM problem (Vista glass) when setting transparencykey

Please consider the minimum code below. This code creates a simple form with a 100 pixels above margin with vista blur glass effect. (For support purpose, we assume this code will be only executed under Vista)

All works very fine until I set the transparencyKey of this form. If the transparencyKey is set to a non empty value, the blur glass region is painted in black.

My pupose is to "bore a hole" in the form to let see a region of the next application in the z-order.

Thanks in advance for help,

Kind regards,

Guy
public partial class Form1 : Form
    {
        MARGINS glassMarges;
 
        public Form1()
        {
            InitializeComponent();
            glassMarges = new MARGINS(0, 0, 100, 0);
            DwmExtendFrameIntoClientArea(this.Handle, ref glassMarges);
            this.Invalidate();  
        }
 
        protected override void OnPaint(PaintEventArgs e)
        {
            e.Graphics.FillRectangle(Brushes.Black, Rectangle.FromLTRB(0, 0,this.ClientRectangle.Width, glassMarges.cyTopHeight));
            base.OnPaint(e);
        }
 
 
        [DllImport("dwmapi.dll", PreserveSig = false)]
        public static extern void DwmExtendFrameIntoClientArea(IntPtr hWnd, ref MARGINS pMargins);
        
        [StructLayout(LayoutKind.Sequential)]
        public struct MARGINS
        {
            public int cxLeftWidth, cxRightWidth, cyTopHeight, cyBottomHeight;
 
            public MARGINS(int left, int right, int top, int bottom)
            {
                cxLeftWidth = left; cyTopHeight = top;
                cxRightWidth = right; cyBottomHeight = bottom;
            }
        }
 
    }

Open in new window

0
guyvaio
Asked:
guyvaio
  • 2
1 Solution
 
guyvaioAuthor Commented:
No answer. Does it mean "no solution" ?
Is really possible that Microsoft has conceived as "incompatible" the transparency and the blur effect in the .net framework ?
Kind regrads,
Guy
0
 
guyvaioAuthor Commented:
No solution ! Where are the experts ?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

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