/// <summary> /// 设置头像 /// </summary> /// <param name="str">头像路径</param> private void setimg(string str) { if (pictureBox1.InvokeRequired) { addmesslistdelegate d = new addmesslistdelegate(setimg); try { this.Invoke(d, str); } catch (Exception) { } } else { try { if (System.IO.File.Exists(str)) { pictureBox1.Image = Image.FromFile(str); } else { // MessageBox.Show("erro: null source"); } } catch (Exception) { } } }
/// <summary> /// 添加好友按钮 /// </summary> /// <param name="str">name</param> private void Addfriend(string str) { if (userlistpanel.InvokeRequired) { addmesslistdelegate d = new addmesslistdelegate(Addfriend); try { this.Invoke(d, str); } catch (Exception) { } } else { Button bt1 = new Button(); SetDouble(bt1); bt1.BackColor = System.Drawing.Color.Transparent; bt1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; bt1.FlatAppearance.BorderSize = 0; bt1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; bt1.Font = new System.Drawing.Font("幼圆", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); bt1.Image = System.Drawing.Image.FromFile(DBfile.apppimgath + @"好友框加下划线.png"); bt1.Name = str; bt1.Size = new System.Drawing.Size(97, 28); bt1.TabIndex = 2; bt1.Text = str; bt1.UseVisualStyleBackColor = false; userlistpanel.Controls.Add(bt1); addfrindpanel(str); bt1.Click += new System.EventHandler(this.bt1_Click); this.Refresh(); } }
private void addfrindpanel(string str) { if (this.InvokeRequired) { addmesslistdelegate d = new addmesslistdelegate(addfrindpanel); try { this.Invoke(d, str); } catch (Exception) { } } else { FlowLayoutPanel txtpane = new FlowLayoutPanel(); Button bt = new Button(); txtpane.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); txtpane.AutoScroll = true; txtpane.BackColor = System.Drawing.Color.Transparent; txtpane.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; txtpane.Font = new System.Drawing.Font("等线 Light", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); txtpane.Location = new Point(166, 130); // txtpane.BackgroundImage = Image.FromFile(DBfile.apppimgath+ "ub.jpg"); // txtpane.BackgroundImageLayout = ImageLayout.Stretch; txtpane.Name = str + "ptxt"; txtpane.WrapContents = false; txtpane.Visible = false; txtpane.Size = new System.Drawing.Size(621, 396); bt.FlatAppearance.BorderSize = 0; bt.FlatStyle = System.Windows.Forms.FlatStyle.Flat; bt.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(32)))), ((int)(((byte)(35)))), ((int)(((byte)(64))))); bt.ImageAlign = System.Drawing.ContentAlignment.TopCenter; bt.Location = new System.Drawing.Point(0, 0); bt.Margin = new System.Windows.Forms.Padding(0); bt.Name = str + "bt"; bt.Size = new System.Drawing.Size(620, 23); bt.TabIndex = 0; bt.UseVisualStyleBackColor = false; bt.Text = "您与" + str + "的更多记忆.."; txtpane.TabStop = true; SetDouble(txtpane); SetDouble(bt); txtpane.Controls.Add(bt); this.Controls.Add(txtpane); // bt.Click += new System.EventHandler(this.bt1_Click); this.Refresh(); } }
/// <summary> /// 设置搜素结果按钮 /// </summary> /// <param name="str">按钮内容</param> private void Setserachbttxt(string str) { if (usertxtbt.InvokeRequired) { addmesslistdelegate d = new addmesslistdelegate(Setserachbttxt); try { this.Invoke(d, str); } catch (Exception) { } } else { usertxtbt.Text = str; } }
/// <summary> /// 清除消息列表 /// </summary> /// <param name="str"></param> private void clearFlist(string str) { if (userlistpanel.InvokeRequired) { addmesslistdelegate d = new addmesslistdelegate(clearFlist); try { this.Invoke(d, str); } catch (Exception) { } } else { userlistpanel.Controls.Clear(); } }
/// <summary> /// 清空消息列表 /// </summary> /// <param name="str"></param> private void clearmesslist(string str) { if (listBox2.InvokeRequired) { addmesslistdelegate d = new addmesslistdelegate(clearmesslist); try { this.Invoke(d, str); } catch (Exception) { } } else { listBox2.Items.Clear(); listBox2.SelectedIndex = listBox1.Items.Count - 1; } }
/// <summary> /// 多线程设置好友姓名lb /// </summary> /// <param name="str">好友姓名</param> private void refname(string str) { if (flb.InvokeRequired) { addmesslistdelegate d = new addmesslistdelegate(refname); try { this.Invoke(d, str); } catch (Exception) { } } else { flb.Text = ""; flb.Text = str; } }
/// <summary> /// 设置个性签名 /// </summary> /// <param name="str">个性签名内容</param> private void setqianming(string str) { if (listBox1.InvokeRequired) { addmesslistdelegate d = new addmesslistdelegate(setqianming); try { this.Invoke(d, str); } catch (Exception) { } } else { listBox1.Items.Clear(); listBox1.Items.Add(str); } }