C# 当顶部窗体在另一个窗口顶部未动画化时,窗体将被分离
我有两个窗体,一个顶部窗体(form1)和一个底部窗体(form2)。我通过将form2的不透明度设置为0.7并对齐form1和form2创建了半透明效果。 效果如下: 但是,当没有任何窗口处于活动状态(form1除外)且我未缩放且应用程序(如邮件)form2被未缩放窗口(本例中为邮件)阻止时 问题是: 我曾经尝试过在form1未激活时最小化和取消动画化form1和form2,但这会使窗口在不是活动窗口时重复闪烁 这是我的密码:C# 当顶部窗体在另一个窗口顶部未动画化时,窗体将被分离,c#,winforms,C#,Winforms,我有两个窗体,一个顶部窗体(form1)和一个底部窗体(form2)。我通过将form2的不透明度设置为0.7并对齐form1和form2创建了半透明效果。 效果如下: 但是,当没有任何窗口处于活动状态(form1除外)且我未缩放且应用程序(如邮件)form2被未缩放窗口(本例中为邮件)阻止时 问题是: 我曾经尝试过在form1未激活时最小化和取消动画化form1和form2,但这会使窗口在不是活动窗口时重复闪烁 这是我的密码: Form2 f2; publi
Form2 f2;
public Form1()
{
InitializeComponent();
this.BackColor = Color.Red;
this.TransparencyKey = Color.Red;
this.StartPosition = FormStartPosition.Manual;
this.Location = new Point(200, 200);
f2 = new Form2();
f2.StartPosition = FormStartPosition.Manual;
f2.Location = new Point(200, 200);
f2.Show();
}
private void AlignForms()
{
//align the forms by setting form2's location to this form
location and also the size
f2.Location = this.Location;
f2.Size = this.Size;
f2.WindowState = this.WindowState;
}
private void Form1_Load(object sender, EventArgs e)
{
//set update var from class 1 to false
update = false;
//make the background color same as transparency key
this.BackColor = Color.LightSlateGray;
this.TransparencyKey = Color.LightSlateGray;
//make the navpanel transparent
navpanel.BackColor = Color.Transparent;
//call the align forms method to align the back and front forms
AlignForms();
//start the timer to align the forms every 1 ms
timer1.Start();
}
private void Timer1_Tick(object sender, EventArgs e)
{
//align the forms
AlignForms();
}
你能帮帮我吗Color.Red会绊倒一只航空虫。这有时对于创建仍然可以检测鼠标的透明窗口非常有用。但不是你想要的,用颜色。紫红色或颜色。莱姆代替。颜色。红色会绊倒空气虫。这有时对于创建仍然可以检测鼠标的透明窗口非常有用。但不是你想要的,用颜色。紫红色或颜色。莱姆代替。