自己写的,类似MSN,QQ的提示窗体
效果图:
这是关键性的代码,把他们放入到一个ArrayList()中,msgid是定义的一个ArrayList,
判断关闭时,在arraylist中把id移除掉,这样就可以实现循环窗体
id = 0;
Boolean flag = false; //id是否已存在
while (true)
{
for (int j = 0; j < msgid.Count; j++)
{
if (id == Convert.ToInt32(msgid[j]))
{
id++;
flag = true;
break;
}
flag = false;
}
if (flag == false)
{
msgid.Add(id);
break;
}
}
int rowCount; //从右下角开始
rowCount = Convert.ToInt32(Screen.PrimaryScreen.WorkingArea.Height / (Size.Height + 5));
point.X = Screen.PrimaryScreen.WorkingArea.Width - (Size.Width + 10) * (Convert.ToInt32(id / rowCount) + 1);
point.Y = Screen.PrimaryScreen.WorkingArea.Height - (Size.Height + 5) * (id % rowCount + 1);
Location = point;
rect.Size = Size; //区域大小等于窗体大小
Opacity = 0.0;
Msg.Text = id.ToString() + " (" + point.X.ToString() + "," + point.Y.ToString() + ")";
delay = time / timer.Interval;
timer.Start();
Boolean flag = false; //id是否已存在
while (true)
{
for (int j = 0; j < msgid.Count; j++)
{
if (id == Convert.ToInt32(msgid[j]))
{
id++;
flag = true;
break;
}
flag = false;
}
if (flag == false)
{
msgid.Add(id);
break;
}
}
int rowCount; //从右下角开始
rowCount = Convert.ToInt32(Screen.PrimaryScreen.WorkingArea.Height / (Size.Height + 5));
point.X = Screen.PrimaryScreen.WorkingArea.Width - (Size.Width + 10) * (Convert.ToInt32(id / rowCount) + 1);
point.Y = Screen.PrimaryScreen.WorkingArea.Height - (Size.Height + 5) * (id % rowCount + 1);
Location = point;
rect.Size = Size; //区域大小等于窗体大小
Opacity = 0.0;
Msg.Text = id.ToString() + " (" + point.X.ToString() + "," + point.Y.ToString() + ")";
delay = time / timer.Interval;
timer.Start();
转载请注明出处:http://www.cnblogs.com/Crayon/archive/2008/07/22/1248562.html