日期:2014-05-18 浏览次数:20892 次
#region *****************动态创建控件, RichTextBox richTextBox = null; private void richTextBox_ContentsResized(object sender, ContentsResizedEventArgs e) { richTextBox.Height = e.NewRectangle.Height + 10; richTextBox.Size = new System.Drawing.Size(912, richTextBox.Height); } private void createControls(string Message, string SendName, string SendTime, int replyId, int i, UnionInfo un) { Panel pnl = new Panel(); pnl.BackColor = Color.White; // GroupBox pnl = new GroupBox(); // pnl.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; richTextBox = new RichTextBox(); richTextBox.BackColor = Color.White; richTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None; richTextBox.Name = "richTextBox" + "_" + i; richTextBox.TabIndex = 7; richTextBox.Text = Message; richTextBox.ReadOnly = true; richTextBox.ScrollBars = RichTextBoxScrollBars.None; richTextBox.ContentsResized += new ContentsResizedEventHandler(richTextBox_ContentsResized); richTextBox.LinkClicked += new LinkClickedEventHandler(richTextBox_LinkClicked); richTextBox.Location = new System.Drawing.Point(20, 30); pnl.Controls.Add(richTextBox); Label lbl1 = new Label(); lbl1.AutoSize = true; lbl1.Location = new System.Drawing.Point(430, 10); lbl1.Name = "lbl7" + "_" + i; lbl1.Size = new System.Drawing.Size(41, 12); lbl1.TabIndex = 6; lbl1.Text = "附件:"; Label lbl2 = new Label(); lbl2.AutoSize = true; lbl2.Location = new System.Drawing.Point(212, 10); lbl2.Name = "lbl8" + "_" + i; lbl2.Size = new System.Drawing.Size(41, 12); lbl2.TabIndex = 5; lbl2.Text = "发件时间:"; Label lbl3 = new Label(); lbl3.AutoSize = true; lbl3.Location = new System.Drawing.Point(20, 10); lbl3.Name = "lbl9" + "_" + i; lbl3.Size = new System.Drawing.Size(41, 12); lbl3.TabIndex = 4; lbl3.Text = "发送人:"; TextBox textBox1 = new TextBox(); textBox1.BackColor = Color.White; textBox1.Location = new System.Drawing.Point(75, 6); textBox1.Name = "textBox1"; textBox1.Size = new System.Drawing.Size(123, 21); textBox1.TabIndex = 4; textBox1.ReadOnly = true; textBox1.Text = SendName; // // textBox2 // TextBox textBox2 = new TextBox(); textBox2.BackColor = Color.White; textBox2.Location = new System.Drawing.Point(280, 6); textBox2.Name = "textBox2"; textBox2.Size = new System.Drawing.Size(140, 21); textBox2.TabIndex = 5; textBox2.ReadOnly = true; textBox2.Text = SendTime; pnl.Controls.Add(richTextBox); pnl.Controls.Add(lbl1); pnl.Controls.Add(lbl2); pnl.Controls.Add(lbl3); pnl.Controls.Add(textBox1); p