Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using System.Threading.Tasks;
- namespace ex._1
- {
- public partial class Form1 : Form
- {
- public delegate void MyDelegate(string strName);
- public Form1()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- public void MyMessage(string str)
- {
- MessageBox.Show(str, "MyMessage", MessageBoxButtons.YesNo,MessageBoxIcon.Information);
- }
- private void button2_Click(object sender, EventArgs e)
- {
- string[] myStr = { "one", "two", "three" };
- MyDelegate delegate1 = new MyDelegate(MyMessage);
- foreach (string str1 in myStr)
- {
- delegate1(str1);
- }
- }
- private void PictureMethod(string str2)
- {
- pictureBox1.Refresh();
- pictureBox1.Load(str2);
- }
- private void button3_Click(object sender, EventArgs e)
- {
- MyDelegate delegate2 = new MyDelegate(PictureMethod);
- foreach(string s in listBox1.Items)
- {
- delegate2(s);
- System.Threading.Thread.Sleep(2000);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement