首页 > 编程语言 >C#委托和窗体之间的方法调用

C#委托和窗体之间的方法调用

时间:2022-11-01 00:11:27浏览次数:33  
标签:调用 C# void System Form1 窗体 UpImageDelegate using public

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;

namespace WindowsFormsApp2
{

public partial class Form1 : Form
{

public UpImageDelegate UpImageDelegate = null;

public static Form1 form1;
public Form1()
{
InitializeComponent();
form1 = this;
}

private void button1_Click(object sender, EventArgs e)
{

}
public void method()
{
button1.Text = UpImageDelegate("节点1:");
}

private void button2_Click(object sender, EventArgs e)
{
Form2 technology = new Form2();
technology.ShowDialog();
}
}
}

//////////////////////////////////////////////////////////////////////////////////////////////////

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;

namespace WindowsFormsApp2
{
public partial class Form2 : Form
{

public Form2()
{
InitializeComponent();
}

public string UPImage(string s)
{

return s + "数据1";
}
private void label1_Click(object sender, EventArgs e)
{

Form1.form1. UpImageDelegate = UPImage;
Form1.form1.method();
this.Close();

}
}
}

标签:调用,C#,void,System,Form1,窗体,UpImageDelegate,using,public
From: https://www.cnblogs.com/xiaohuzi007/p/16846396.html

相关文章

  • Pictionary 方法记录
    [COCI2017-2018#5]Pictionary题面翻译题目描述在宇宙一个不为人知的地方,有一个星球,上面有一个国家,只有数学家居住。在这个国家有\(n\)个数学家,有趣的是,每个数学家都住......
  • RPC调用与HTTP调用
    1、RPC服务 从三个角度来介绍RPC服务:分别是RPC架构,同步异步调用以及流行的RPC框架。 1.1、RPC架构 一个完整的RPC架构里面包含了四个核心的组件,分别是Client,Se......
  • VScode Configuration STM32
    基于VScode搭建STM32运行环境所需软件vscode:是我们的代码编辑器STM32CubeMX:是我们配置和初始化的软件OpenOCD:是开源片上调试器,他下载完是一个压缩包,需要配......
  • 【五期杨志】CCF-A(NeurIPS'20) Self-supervised multimodal versatile networks
    AlayracJB,RecasensA,SchneiderR,etal.Self-supervisedmultimodalversatilenetworks[J].AdvancesinNeuralInformationProcessingSystems,2020,33:2......
  • USB_LP_CAN1_RX0_IRQn一直重定义
    USB_LP_CAN1_RX0_IRQn一直重定义怎么回事  keil5编译,想要用CAN接收中断接收数据,出现"USB_LP_CAN1_RX0_IRQn"hasalreadybeendeclaredinthecurrentscop......
  • 1013 Battle Over Cities
    Itisvitallyimportanttohaveallthecitiesconnectedbyhighwaysinawar.Ifacityisoccupiedbytheenemy,allthehighwaysfrom/towardthatcityarec......
  • HCIE-桌面云运营Two
    桌面云登录流程获取登录界面TC/SC->VLB->WI(为了方便,可配域名访问)账号密码的鉴权TC/SC->VLB->WI->AD获取虚拟机列表TC/SC->VLB->WI->HDC->DB预连接......
  • HCIE-桌面云运营Four
    桌面云快速发放流程登录FC平台制作虚拟机模板模板制作流程创建空的虚拟机挂载光驱,按照操作系统关闭防火墙切换超级管理员账号挂载模板制作工具链接克隆无手动......
  • HCIE-FusionBlock分布式块存储
    FusionStorageBlock分布式块存储华为存储分类全闪存(OceanStorDorado)混合闪存(OceanStorV3、OceanStorV5)边缘数据存储(FusionCube)分布式存储(OceanStor100D)......
  • Docker设置容器开机自启
    文章目录......