前台:在winform窗体Form1放入pictureBox1 后台代码: namespace 点击小图变成大图 { public delegate void ClickDelegateHander(string Url); public partial class Form1 : Form { public event ClickDelegateHander ClickEvent; public Form1() { InitializeComponent(); } private void p…
Demo窗体图片,Form1 Demo窗体图片,Form2 公共委托 using System; namespace _DeleFrm{ public class Dele { public static Action<string> SendDele; }} form1窗体代码 using System;using System.Windows.Forms; namespace _DeleFrm{ public partial class Form1 : Form { …
窗体间的传值,最好使用委托方式传值,开始之前,我们先来说一下委托与事件的关系. 委托:是一个类. 事件:是委托类型的一个特殊实例,只能在类的内部触发执行. 首先创建2个窗体,这里我们以form1为发送窗体,form2为接收窗体 form1窗体 form2窗体 方式一(最简单的方式) form1窗体代码 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; us…