Reputation: 1900
I made a capture app in C# with winforms. I'm trying to see through a winform from another winform.
What I have now is this:
The black background with the opacity is winform number 1
And the blue rectangle with Transparent Fill is in winform number 2
I need a way to see the content of the website page through winform 1.
This is what i'm trying to accomplish :
I already tried to set the Fill Color to the Transparent Key Color like this:
This is TransparencyKey code for winform number 1:
this.TransparencyKey = System.Drawing.Color.Pink;
This is the code that draw the rectangle on winform number 2:
SolidBrush TransparentBrush = new SolidBrush(Color.Transparent);
Pen MyPen = new Pen(Color.Blue, 2);
private void ThePaint(object sender, System.Windows.Forms.PaintEventArgs e)
{
g.FillRectangle(TransparentBrush, CurrentTopLeft.X, CurrentTopLeft.Y, RectangleWidth, RectangleHeight);
g.DrawRectangle(MyPen, CurrentTopLeft.X, CurrentTopLeft.Y, RectangleWidth, RectangleHeight);
RectangleDrawn = true;
}
Upvotes: 3
Views: 282
Reputation: 733
You could try putting a panel on your form 2 and then setting it's colour to "Pink" - that way, it will be transparent through the form 2 to the web page behind. The only downside is that it does look odd if you have any controls on it. All this is achievable through the WinForm designer.
Upvotes: 1