是这样的 我那要在屏幕的右下角 提示 有没有新的 文章 如果有那就显示 新的文章有几条 然后显示 文章的名字 在点即文章的名字的时候 跳转到 该文章的详细 信息页面 怎么做 我右下角菜单弹出已经做好了但是 不知道该怎么写 查询到新文章的名字提示 还有就是 文章 链接的URL 以下是我的代码 //屏幕的大小
public Rectangle rect = System.Windows.Forms.SystemInformation.VirtualScreen;
private Point p = new Point();//坐标
private int topStop = 0;
private int upTime = 10; //上升时间
private int downTime = 10; //下降时间
private int upSize = 2;//上升大小
private int downSize = 3;//下降大小
private int stopTime = 1000;
private bool isUp = true;//是不是上升
public MSG()
{
InitializeComponent();
p.X = rect.Width - this.Width;
p.Y = rect.Height;
topStop = rect.Height - this.Height - 25;
}
public MSG(int width, int height):base()
{
this.Width = width;//设置宽高
this.Height = height;
p.X = rect.Width - width;
p.Y = rect.Height;
topStop = rect.Height - height - 25;
}
public int UpTime
{
set
{
this.upTime = value;
}
}
public int DownTime
{
set
{
this.downTime = value;
}
}
public int UpSize
{
set
{
this.upSize = value;
}
}
public int DownSize
{
set
{
this.downSize = value;
}
}
public void Springs()
{
this.Location = p;//起始位置
if (!this.Visible)
{
this.Visible = true;
}
this.mytimer.Enabled = true;
} private void mytimer_Tick(object sender, EventArgs e)
{
if (isUp)
{
if (this.Location.Y < topStop)//上升到最高点
{
this.mytimer.Interval = stopTime;
isUp = false;
}
else
{
//上升
if (upTime != this.mytimer.Interval)
{
this.mytimer.Interval = upTime;
}
int k = this.Location.Y;
this.Location = new Point(p.X, k - upSize);
}
}
else
{
if (this.Location.Y > p.Y) //下降到原来的点。
{
this.mytimer.Interval = upTime;
isUp = true;
this.mytimer.Enabled = false;
}
else
{
if (downTime != this.mytimer.Interval)
{
this.mytimer.Interval = downTime;
}
int k = this.Location.Y;
this.Location = new Point(p.X, k + downSize);
}
}
}
//停止设置
private void MSG_MouseEnter(object sender, EventArgs e)
{
this.mytimer.Enabled = false;
} private void MSG_MouseLeave(object sender, EventArgs e)
{
this.mytimer.Enabled = true;
} private void MSG_Load(object sender, EventArgs e)
{ int tiaoshu = Convert.ToInt32( ConfigurationSettings.AppSettings["count"]);//当前 默认数据库字段条数
int tiaoshu2 = Convert.ToInt32(ConfigurationSettings.AppSettings["count1"]);//以前的条数
int Newtiaoshu = 0; //记录多少 新的条数
if (GetDetaile() > tiaoshu)
{
Detailed d =NewXinXi();
tiaoshu = GetDetaile();
Newtiaoshu = tiaoshu - tiaoshu2;
linkLabel1.Text = "你有新的消息:" + Newtiaoshu + "条";
linkLabel3.Text =Convert.ToString( d.DetailedName); ConfigurationSettings.AppSettings["count"] =Convert.ToString( tiaoshu);
ConfigurationSettings.AppSettings["count1"] =Convert.ToString( tiaoshu2 + Newtiaoshu);
mytimer.Enabled = true;// }
else if (GetDetaile() < tiaoshu)
{ ConfigurationSettings.AppSettings["count"] =Convert.ToString(tiaoshu);
}
} private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
}
public static int GetDetaile()//查询数据库内数据条数
{
string sql = "select count(*) from Detailed";
DataTable dt = DBHelper.GetList(sql, null);
int i = 0;
return i = Convert.ToInt32(dt.Rows[0][0]); }
public static Detailed NewXinXi() { string sql = "select top 1 * from Detailed order by Shijian desc";
DataTable dt = DBHelper.GetList(sql, null);
Detailed d = null;
foreach (DataRow dr in dt.Rows) {
d = new Detailed();
d.DetailedName = Convert.ToString(dr["DetailedName"]);
}
return d;
}
public Rectangle rect = System.Windows.Forms.SystemInformation.VirtualScreen;
private Point p = new Point();//坐标
private int topStop = 0;
private int upTime = 10; //上升时间
private int downTime = 10; //下降时间
private int upSize = 2;//上升大小
private int downSize = 3;//下降大小
private int stopTime = 1000;
private bool isUp = true;//是不是上升
public MSG()
{
InitializeComponent();
p.X = rect.Width - this.Width;
p.Y = rect.Height;
topStop = rect.Height - this.Height - 25;
}
public MSG(int width, int height):base()
{
this.Width = width;//设置宽高
this.Height = height;
p.X = rect.Width - width;
p.Y = rect.Height;
topStop = rect.Height - height - 25;
}
public int UpTime
{
set
{
this.upTime = value;
}
}
public int DownTime
{
set
{
this.downTime = value;
}
}
public int UpSize
{
set
{
this.upSize = value;
}
}
public int DownSize
{
set
{
this.downSize = value;
}
}
public void Springs()
{
this.Location = p;//起始位置
if (!this.Visible)
{
this.Visible = true;
}
this.mytimer.Enabled = true;
} private void mytimer_Tick(object sender, EventArgs e)
{
if (isUp)
{
if (this.Location.Y < topStop)//上升到最高点
{
this.mytimer.Interval = stopTime;
isUp = false;
}
else
{
//上升
if (upTime != this.mytimer.Interval)
{
this.mytimer.Interval = upTime;
}
int k = this.Location.Y;
this.Location = new Point(p.X, k - upSize);
}
}
else
{
if (this.Location.Y > p.Y) //下降到原来的点。
{
this.mytimer.Interval = upTime;
isUp = true;
this.mytimer.Enabled = false;
}
else
{
if (downTime != this.mytimer.Interval)
{
this.mytimer.Interval = downTime;
}
int k = this.Location.Y;
this.Location = new Point(p.X, k + downSize);
}
}
}
//停止设置
private void MSG_MouseEnter(object sender, EventArgs e)
{
this.mytimer.Enabled = false;
} private void MSG_MouseLeave(object sender, EventArgs e)
{
this.mytimer.Enabled = true;
} private void MSG_Load(object sender, EventArgs e)
{ int tiaoshu = Convert.ToInt32( ConfigurationSettings.AppSettings["count"]);//当前 默认数据库字段条数
int tiaoshu2 = Convert.ToInt32(ConfigurationSettings.AppSettings["count1"]);//以前的条数
int Newtiaoshu = 0; //记录多少 新的条数
if (GetDetaile() > tiaoshu)
{
Detailed d =NewXinXi();
tiaoshu = GetDetaile();
Newtiaoshu = tiaoshu - tiaoshu2;
linkLabel1.Text = "你有新的消息:" + Newtiaoshu + "条";
linkLabel3.Text =Convert.ToString( d.DetailedName); ConfigurationSettings.AppSettings["count"] =Convert.ToString( tiaoshu);
ConfigurationSettings.AppSettings["count1"] =Convert.ToString( tiaoshu2 + Newtiaoshu);
mytimer.Enabled = true;// }
else if (GetDetaile() < tiaoshu)
{ ConfigurationSettings.AppSettings["count"] =Convert.ToString(tiaoshu);
}
} private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
}
public static int GetDetaile()//查询数据库内数据条数
{
string sql = "select count(*) from Detailed";
DataTable dt = DBHelper.GetList(sql, null);
int i = 0;
return i = Convert.ToInt32(dt.Rows[0][0]); }
public static Detailed NewXinXi() { string sql = "select top 1 * from Detailed order by Shijian desc";
DataTable dt = DBHelper.GetList(sql, null);
Detailed d = null;
foreach (DataRow dr in dt.Rows) {
d = new Detailed();
d.DetailedName = Convert.ToString(dr["DetailedName"]);
}
return d;
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货