public questionSample(object e) { ask_Content askContent = new ask_Content(); askContent = (ask_Content)e; InitializeComponent(); Img.BackgroundImage = askContent.contentImg; questioner.Text = askContent.name; type.Text = "#" + askContent.type.Trim() + "#"; date.Text = askContent.date; title.Text = askContent.title; this.Name = askContent.title; }
public void askContentshow(string type)//问题显示 { this.ask_Content.Controls.Clear(); SqlDataReader askContent; if (type == "") { try { askContent = LibraryBLL.question.askContent(); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } } else { try { askContent = LibraryBLL.question.askContent(type); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } } while (askContent.Read()) { LibraryModel.ask_Content askContentdate = new ask_Content(); askContentdate.name = askContent["questionerId"].ToString(); askContentdate.type = askContent["type"].ToString(); askContentdate.date = askContent["uploadTime"].ToString(); askContentdate.contentImg = img(askContentdate.name); askContentdate.title = askContent["title"].ToString(); LibrarySET.questionSample UIcomment = new LibrarySET.questionSample(askContentdate); UIcomment.Click += new EventHandler(this.askContent_Click); this.ask_Content.Controls.Add(UIcomment); } }