【发布时间】:2013-04-11 15:26:36
【问题描述】:
我在 C# 中使用 winforms 制作了一个捕获应用程序。 我正在尝试从另一个 winform 中查看一个 winform。
我现在拥有的是:
不透明的黑色背景是winform number 1
带有透明填充的蓝色矩形在winform number 2
我需要一种通过winform 1查看网站页面内容的方法。
这就是我想要完成的:
我已经尝试将填充颜色设置为透明键颜色,如下所示:
这是 1 号 winform 的 TransparencyKey 代码:
this.TransparencyKey = System.Drawing.Color.Pink;
这是在 2 号 winform 上绘制矩形的代码:
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;
}
【问题讨论】:
-
我认为你最好使用 WPF。
-
我希望!,但我不能为此使用 WPF。
-
1.它已经完成了。 2.我是从Winforms开始才知道WPF的