Guest User

Untitled

a guest
Dec 8th, 2017
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. public void AddContact(string Contact_name, string email, bool selected = false, string path="")
  2. {
  3. // Create a new ContactListItem and set the required parameters with the "Add" method.
  4. ContactListItem contact_item = new ContactListItem();
  5. contact_item.Add(Contact_name, email,selected,path);
  6. // Then set the ContactListItem's Dock property to "Top".
  7. contact_item.Dock = DockStyle.Top;
  8. // Add the ContactListItem to the Panel.
  9. panel1.Controls.Add(contact_item);
  10. // Finally, bring the ContactListItem to the front to avoid disarrangements.
  11. contact_item.BringToFront();
  12.  
  13. }
  14.  
  15. // Add a list of pre-defined ContactListItems.
  16. public void AddContacts()
  17. {
  18. AddContact("Visual Idiot", "Vi@su.al",false, @"C: \Users\Beckie\Pictures\avatars\avatar-one.jpg");
  19. AddContact("Kerem Suer", "Kerem@kerem.co",false, @"C:\Users\Beckie\Pictures\avatars\avatar-two.jpg");
  20. AddContact("Josh Hamsley", "Josh@hamsley.com",false, @"C:\Users\Beckie\Pictures\avatars\avatar-three.jpg");
  21. AddContact("Fabio", "fabio@ffabs.com",false, @"C:\Users\Beckie\Pictures\avatars\avatar-four.jpg");
  22. AddContact("Anthony Lagoon", "anthony@lagoon.co",false, @"C:\Users\Beckie\Pictures\avatars\avatar-five.png");
  23. AddContact("Jenny Shen", "jen@shen.co",false, @"C:\Users\Beckie\Pictures\avatars\avatar-six.png");
  24. AddContact("Charlie Waite", "charlie@focuslab.com",false, @"C:\Users\Beckie\Pictures\avatars\avatar-seven.png");
  25. AddContact("Ed Wellbrook", "El@wb.co",false, @"C:\Users\Beckie\Pictures\avatars\avatar-eight.png");
  26. }
  27. private void Form1_Load(object sender, EventArgs e)
  28. {
  29. AddContacts();
  30. AddList();
  31. }
Add Comment
Please, Sign In to add comment