在透明窗体上的文字逐渐消失问题。 我创建了一个透明的窗体,在窗体上有几行文字,想实现其中的一行文字逐渐消失的效果。怎么弄啊? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 private void button4_Click(object sender, EventArgs e) { Label label = label1; label.Visible = false; Graphics g = this.CreateGraphics(); g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; StringFormat sf = new StringFormat(StringFormat.GenericTypographic); //sf.Alignment = label.TextAlign...;必要的话在这里判断位置 for (int i = 0; i < 255; i++) { using (Brush brush = new SolidBrush(Color.FromArgb(i, i, i))) { Application.DoEvents(); System.Threading.Thread.Sleep(10); g.DrawString(label.Text, label.Font, brush, new Rectangle(label.Location, label.Size), sf); } } this.Refresh(); } private void button4_Click(object sender, EventArgs e) { Label label = label1; label.Visible = false; Graphics g = this.CreateGraphics(); g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; StringFormat sf = new StringFormat(StringFormat.GenericTypographic); //sf.Alignment = label.TextAlign;必要的话在这里判断位置 switch(label1.TextAlign)//不加对齐方式的判断的话,会感觉文字的跳跃 { case ContentAlignment.BottomCenter: sf.Alignment = StringAlignment.Center; sf.LineAlignment = StringAlignment.Far; break;// case .....// break; } for (int i = 0; i < 255; i++) { using (Brush brush = new SolidBrush(Color.FromArgb(i, i, i))) { Application.DoEvents(); System.Threading.Thread.Sleep(10); g.DrawString(label.Text, label.Font, brush, new Rectangle(label.Location,new Size(label.Width-1,label.Height-1)), sf); } } this.Refresh(); } treeview绑定数据 会C# 操作oracle Long型数据有木有会的? sendmessage 发信息 ? 关于控件重叠时的显示问题 大家给介绍几个vs2005中经典的第三方控件吧! 如何将DataGrid的数据,在同一行上,按列循环? C#实现XML搜索 XMLReader的问题 怎么实现DATAGRID的分页? 本人是新手 有两个问题想请教一下各位 希望能为我解答 不胜感激 <%#Bind("state")=="0":"批准";"没有批准"%> 急救语法错误 急求!!从一个数据文件中读取数据添加到另一个数据文件中。
{
Label label = label1;
label.Visible = false;
Graphics g = this.CreateGraphics();
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
StringFormat sf = new StringFormat(StringFormat.GenericTypographic);
//sf.Alignment = label.TextAlign...;必要的话在这里判断位置
for (int i = 0; i < 255; i++)
{
using (Brush brush = new SolidBrush(Color.FromArgb(i, i, i)))
{
Application.DoEvents();
System.Threading.Thread.Sleep(10);
g.DrawString(label.Text, label.Font, brush, new Rectangle(label.Location, label.Size), sf);
}
}
this.Refresh();
}
{
Label label = label1;
label.Visible = false;
Graphics g = this.CreateGraphics();
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
StringFormat sf = new StringFormat(StringFormat.GenericTypographic);
//sf.Alignment = label.TextAlign;必要的话在这里判断位置
switch(label1.TextAlign)//不加对齐方式的判断的话,会感觉文字的跳跃
{
case ContentAlignment.BottomCenter:
sf.Alignment = StringAlignment.Center;
sf.LineAlignment = StringAlignment.Far;
break;
// case .....
// break;
}
for (int i = 0; i < 255; i++)
{
using (Brush brush = new SolidBrush(Color.FromArgb(i, i, i)))
{
Application.DoEvents();
System.Threading.Thread.Sleep(10);
g.DrawString(label.Text, label.Font, brush, new Rectangle(label.Location,new Size(label.Width-1,label.Height-1)), sf);
}
}
this.Refresh();
}