private void LinkClickFirend(object sender, EventArgs e) { MyLinklable my = (MyLinklable)sender; SendMessage friendform = new SendMessage(this, my.Firiend); friendform.ShowDialog(); }
private void RefreshFriendlist() { //lstvw_myfirends.Columns.Clear(); //lstvw_myfirends.Items.Clear(); lstvw_myfirends.Controls.Clear(); this.lstvw_myfirends.Columns.Add("在线好友列表", 300, HorizontalAlignment.Left); int i = 0; foreach (var friend in userdic) { var link = new MyLinklable(); link.Firiend = friend.Value.UserInfo; link.Click += LinkClickFirend; link.ImageIndex = i; link.Text = friend.Value.UserInfo.Userid; //lstvw_myfirends.BeginUpdate(); this.lstvw_myfirends.Controls.Add(link); //lstvw_myfirends.EndUpdate(); //var item = new ListViewItem(); //item.ImageIndex = i; //item.Text = friend.Value.UserInfo.Userid; //lstvw_myfirends.BeginUpdate(); //lstvw_myfirends.Add(link); //lstvw_myfirends.Items[lstvw_myfirends.Items.Count - 1].EnsureVisible(); //滚动到最后 //lstvw_myfirends.EndUpdate(); i++; } }