this.Opacity = 0; this.Opacity = 1; 为何效果不同 什么意思?求详解

[复制链接]
查看11 | 回复2 | 2011-4-22 02:11:53 | 显示全部楼层 |阅读模式
private void Form2_Load(object sender, EventArgs e)

{

if (this.Text == \"淡隐\")

{

this.timer1.Enabled = true;

this.timer2.Enabled = false;

this.Opacity = 1;


}

else

{

this.timer1.Enabled = false;

this.timer2.Enabled = true;

this.Opacity = 0;

}

}


private void timer1_Tick(object sender, EventArgs e)

{

this.Opacity = this.Opacity - 0.1;

if (this.Opacity0.1)

{

timer1.Enabled = false;

this.Close();

}

}


private void timer2_Tick(object sender, EventArgs e)

{

this.Opacity = this.Opacity 0.1;

if(this.Opacity ==1)

{

timer2.Enabled = false;

this.Close();

}

}
回复

使用道具 举报

千问 | 2011-4-22 02:11:53 | 显示全部楼层
<pre id=\"best-answer-content\" class=\"reply-text mb10\">this.timer1.Enabled = false;

this.timer2.Enabled = true;

this.Opacity = 0;//这一句表示将窗体透明度初始化为0;如果不加这一句,则为默认,默认为1;
回复

使用道具 举报

千问 | 2011-4-22 02:11:53 | 显示全部楼层
<pre class=\"replyask-text\" id=\"content-5044651\">this.Opacity = 1;
那this.Opacity = 11;呢?我试过效果也差不多 是透明度为11%

为何要这样输入?timer2透明度不是已经可以一直增加了吗?为何删去this.Opacity = 0;就没那个效果了


{

this.timer1.Enabled = false;

this.timer2.Enabled = true;

this.Opacity = 0;

}
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行