public WordForm(long id, string type) : this() { this.ID = id; News newnews = new News(); news = newnews.QueryUserId(id); news = news.Where(q => q.type == type).ToList(); this.panel1.Controls.Clear(); foreach (var item in news) { NEWsForm childform = new NEWsForm(item, ID); childform.TopLevel = false; childform.FormBorderStyle = FormBorderStyle.None; childform.Dock = DockStyle.Top; this.panel1.Controls.Add(childform); childform.BringToFront(); childform.Show(); } }
public void iniWindow() { #region 获取树洞信息 List <News> FreeData = news.Where(q => q.type == "0").ToList(); panel1.Controls.Clear(); //panel1.Controls.Add(Label(FreeData[0].userid.ToString(), x + 60, y - 25, 30, 15)); foreach (var item in FreeData) { NEWsForm childform = new NEWsForm(item, ID); childform.TopLevel = false; childform.FormBorderStyle = FormBorderStyle.None; childform.Dock = DockStyle.Top; panel1.Controls.Add(childform); childform.BringToFront(); childform.Show(); } #endregion #region 失物招领 List <News> MistakesAndFound = news.Where(q => q.type == "1").ToList(); panel2.Controls.Clear(); foreach (var item in MistakesAndFound) { NEWsForm childform = new NEWsForm(item, ID); childform.TopLevel = false; childform.FormBorderStyle = FormBorderStyle.None; childform.Dock = DockStyle.Top; panel2.Controls.Add(childform); childform.BringToFront(); childform.Show(); } #endregion #region 公告 List <News> Notice = news.Where(q => q.type == "2").ToList(); #endregion }