Yesterday I found something very strange (I think). It looks like Form.TransparencyKey gives different results based on which color is used as BackgroundColor and TransparencyKey. If you want to reproduce this, do following:
- Create new Windows Forms application
- Drop a
Panelon the form - Give it "Green" as
BackgroundColorand set Form1'sTransparencyKeyalso to Green - Run program and put Form with "hole" over something and you'll see that you can click through that hole (as described by MSDN)
- Now change both colors to "Red" and run application - you'll see the "hole" but you no longer can click though it
Do you know why is that happening? What's the rule? I'm using .NET 4 with VS2010, tested on two computers with same configuration.
Not much code for this... But I can post settings in designer:
private void InitializeComponent()
{
this.panel1 = new System.Windows.Forms.Panel();
this.SuspendLayout();
//
// panel1
//
this.panel1.BackColor = System.Drawing.Color.Red;
this.panel1.Location = new System.Drawing.Point(23, 26);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(229, 176);
this.panel1.TabIndex = 0;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(284, 262);
this.Controls.Add(this.panel1);
this.Name = "Form1";
this.Text = "Form1";
this.TransparencyKey = System.Drawing.Color.Red;
this.ResumeLayout(false);
}
//that outside:
private System.Windows.Forms.Panel panel1;