winform动态显⽰公告
nook#region 加载公告
private void loadAnnounce()
{
DataTable dt = urService.findAnnounce();//得到所有符合条件的公告
if (pMid.Controls.Count > 0)
{
pMid.Controls.Clear();
}
if (dt!=null && dt.Rows.Count >0)
{
int x = 0;
int y = 10;
Panel pGG = new Panel();
课后答案pGG.Location = new Point(x, y);
int width = 0;
for (int i = 0; i < dt.Rows.Count; i++)
{
LinkLabel lb = new LinkLabel();
string title = dt.Rows[i]["title"].ToString();
lb.Font = new Font("宋体", 9);
Graphics graphics = CreateGraphics();
亚美尼亚语
SizeF sizeF = graphics.MeasureString(title, new Font("宋体", 9)); //获得字符串对应的宽度(像素) lb.Text = title;
noon
lb.Location = new Point(x, y);
lb.Size = new Size(Convert.ToInt32(sizeF.Width), 35);
object obj = new object();
obj = dt.Rows[i]["GUID"].ToString();
新冠病毒或永不消失lb.Links.Add(new LinkLabel.Link(0, title.Length, obj));
lb.LinkClicked += new LinkLabelLinkClickedEventHandler(lb_LinkClicked);
pGG.Controls.Add(lb);
x = lb.Location.X + Convert.ToInt32(sizeF.Width);
width += Convert.ToInt32(sizeF.Width);
}
pGG.Size = new Size(width, pMid.Height);
pMid.Controls.Add(pGG);
}
}
#endregion
//公告滚动
皇室英语
lpl是什么private void timer1_Tick(object nder, EventArgs e)
{
if (pMid.Controls.Count > 0)
{北京mba
pMid.Controls[0].Left -= 2;
shut up
if (pMid.Controls[0].Right < 0)
{
pMid.Controls[0].Left = pMid.Controls[0].Width; }
}现百年前水果蛋糕
}