Guest User

Untitled

a guest
Jan 17th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. //events
  2. public new event EventHandler Click
  3. {
  4. add { picbox.Click += value; }
  5. remove { picbox.Click -= value; }
  6. }
  7.  
  8. public Form1()
  9. {
  10. InitializeComponent();
  11. foreach (Control c in this.Controls)
  12. {
  13. TP1CustomListView ctLV = c as TP1CustomListView;
  14. if (ctLV != null)
  15. {
  16. ctLV.Click += ctLV_Click;
  17.  
  18. }
  19. }
  20. }
  21.  
  22. void ctLV_Click(object sender, EventArgs e)
  23. {
  24.  
  25. TP1CustomListView customView = sender as TP1CustomListView;
  26.  
  27. if(customView!=null)
  28. {
  29. MessageBox.Show(customView.subtbTitle.Text + customView.subtbContent.Text + customView.subtbFooter.Text);
  30. }
  31. }
  32.  
  33. //sub controls
  34. public PictureBox subPicbox;
  35. public TextBox subtbTitle;
  36. public TextBox subtbContent;
  37. public TextBox subtbFooter;
  38. public TP1CustomListView()
  39. {
  40. InitializeComponent();
  41. subtbTitle = txtTitle;
  42. subtbContent = txtContent;
  43. subtbFooter = txtFooter;
  44. subPicbox = picbox;
  45. tableLayoutPanel1.Dock = DockStyle.Fill;
  46. }
Add Comment
Please, Sign In to add comment