【发布时间】:2012-03-16 22:39:02
【问题描述】:
我有一个 XNA 项目,它利用 Windows.Forms 创建 GUI。我们的 GUI 由左面板和右面板组成。他们都有一个图像覆盖它们(我们称它们为面板图像)。这些图像上有带有图像的按钮。现在面板图像没有完全覆盖面板。现在我们要做的是使面板不可见或透明,这样您就只能看到面板图像。在下图中,我圈出了我想要透明/不可见的内容。正如您在项目的上部看到的那样,它看起来已经是透明的,但这仅仅是因为它与 XNA 场景的背景融为一体。在面板位于地面上方的底部,您可以看到面板如何比面板图像延伸得更远。那么,有谁知道我如何使这些部分不可见/透明。
好吧,我们已经搞砸了使面板颜色为 Color.Transparent、洋红色(XNA 透明颜色),但这些尝试都没有奏效。欢迎提供任何意见/建议,非常感谢。
这是设置面板的代码:
this.pnlLeftSide.BackgroundImage = global::Referenceator_UI.Resources.LeftBar;
this.pnlLeftSide.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
this.pnlLeftSide.Controls.Add(this.btnScreenShot);
this.pnlLeftSide.Controls.Add(this.btnScale);
this.pnlLeftSide.Controls.Add(this.btnMove);
this.pnlLeftSide.Controls.Add(this.btnRotate);
this.pnlLeftSide.Controls.Add(this.btnSelect);
this.pnlLeftSide.Location = new System.Drawing.Point(0, 0);
this.pnlLeftSide.Name = "pnlLeftSide";
this.pnlLeftSide.Size = new System.Drawing.Size(197, Screen.PrimaryScreen.WorkingArea.Height);
this.pnlLeftSide.Dock = DockStyle.Left;
this.pnlLeftSide.BackColor = controlColor; //this what we want invisible/transparent
-感谢 stackoverflow 社区
【问题讨论】:
-
为什么你的面板太大了?让它更小:)
标签: c# winforms user-interface colors xna-4.0