├── DelDemoAndExtensionMethods.sln
├── DelDemoAndExtensionMethods.suo
├── DelDemoAndExtensionMethods.v12.suo
├── README.md
└── WinFrmDemo
├── App.config
├── MainForm.Designer.cs
├── MainForm.cs
├── MainForm.resx
├── MyEventArg.cs
├── ObeserverFormA.Designer.cs
├── ObeserverFormA.cs
├── ObeserverFormA.resx
├── ObeserverFormB.Designer.cs
├── ObeserverFormB.cs
├── ObeserverFormB.resx
├── Program.cs
├── Properties
├── AssemblyInfo.cs
├── Resources.Designer.cs
├── Resources.resx
├── Settings.Designer.cs
└── Settings.settings
└── WinFormTransValueDemo.csproj
/DelDemoAndExtensionMethods.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2013
4 | VisualStudioVersion = 12.0.21005.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinFormTransValueDemo", "WinFrmDemo\WinFormTransValueDemo.csproj", "{98DD3650-6BB9-41C3-BE96-F7E8FABD8EDD}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {98DD3650-6BB9-41C3-BE96-F7E8FABD8EDD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {98DD3650-6BB9-41C3-BE96-F7E8FABD8EDD}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {98DD3650-6BB9-41C3-BE96-F7E8FABD8EDD}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {98DD3650-6BB9-41C3-BE96-F7E8FABD8EDD}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/DelDemoAndExtensionMethods.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yes-or-no/WinFormTransValueDemoByDelOrEvent/5ddc9ab1c1c6654c07179024ba8f8405fec008dd/DelDemoAndExtensionMethods.suo
--------------------------------------------------------------------------------
/DelDemoAndExtensionMethods.v12.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yes-or-no/WinFormTransValueDemoByDelOrEvent/5ddc9ab1c1c6654c07179024ba8f8405fec008dd/DelDemoAndExtensionMethods.v12.suo
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # WinFormTransValueDemoByDelOrEvent
2 | 使用方法:使用vs2013打开编译运行即可;
3 | C#winform窗体间传值,三种方法示例,注释详细
4 |
5 | ###方法1:通过保存对象的引用调用其方法实现对子窗体的控制;
6 | ###方法2:通过委托,在子窗体显示之前,为委托赋值,关注主窗体的数据变化,当有当有多个窗体需要接收信息,只需要为委托继续赋值(+=)即可,实现了数据传递的解耦性;
7 | ###方法3:子窗体弹出来之前,注册事件,关注主窗体消息的变化,当有多个窗体需要接收信息,,只需要分别为窗体注册数据接收事件即可,实现了数据传递的解耦性;
8 |
9 | 方法2与方法3即为发布订阅模式(观察者模式);
10 | 主窗体为消息的发布者,窗体A、B等等为消息的接收者;
11 |
12 |
--------------------------------------------------------------------------------
/WinFrmDemo/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/WinFrmDemo/MainForm.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace WinFrmDemo
2 | {
3 | partial class MainForm
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.btnSendMsg = new System.Windows.Forms.Button();
32 | this.txtMsg = new System.Windows.Forms.TextBox();
33 | this.SuspendLayout();
34 | //
35 | // btnSendMsg
36 | //
37 | this.btnSendMsg.Location = new System.Drawing.Point(309, 119);
38 | this.btnSendMsg.Name = "btnSendMsg";
39 | this.btnSendMsg.Size = new System.Drawing.Size(75, 23);
40 | this.btnSendMsg.TabIndex = 0;
41 | this.btnSendMsg.Text = "发送消息";
42 | this.btnSendMsg.UseVisualStyleBackColor = true;
43 | this.btnSendMsg.Click += new System.EventHandler(this.btnSendMsg_Click);
44 | //
45 | // txtMsg
46 | //
47 | this.txtMsg.Location = new System.Drawing.Point(31, 121);
48 | this.txtMsg.Name = "txtMsg";
49 | this.txtMsg.Size = new System.Drawing.Size(259, 21);
50 | this.txtMsg.TabIndex = 1;
51 | //
52 | // MainForm
53 | //
54 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
55 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
56 | this.ClientSize = new System.Drawing.Size(405, 346);
57 | this.Controls.Add(this.txtMsg);
58 | this.Controls.Add(this.btnSendMsg);
59 | this.Name = "MainForm";
60 | this.Text = "MainForm";
61 | this.Load += new System.EventHandler(this.ParentFrm_Load);
62 | this.ResumeLayout(false);
63 | this.PerformLayout();
64 |
65 | }
66 |
67 | #endregion
68 |
69 | private System.Windows.Forms.Button btnSendMsg;
70 | private System.Windows.Forms.TextBox txtMsg;
71 | }
72 | }
--------------------------------------------------------------------------------
/WinFrmDemo/MainForm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace WinFrmDemo
12 | {
13 |
14 |
15 | public partial class MainForm : Form
16 | {
17 | #region 方法1(不推荐)--通过保存对象的引用调用的对象的公有方法实现窗体的传值
18 | //当接收数据的窗体增加,需要修改发送消息的代码,并且增加相应数量的窗体引用 可扩展性差,耦合性较高
19 | //public ObeserverFormA ChildFormA { get; set; }
20 | //public ObeserverFormB ChildFormB { get; set; }
21 | #endregion
22 |
23 | #region 方法2---委托方式传值
24 | //定义发布消息的委托 委托是一个类型 委托可以在外部获得执行
25 | public Action SendMsg { get; set; }
26 | #endregion
27 |
28 | #region 方法3(推荐)--事件方式
29 | //增加event关键字
30 | //定 义消息发布的事件 事件是委托的一个特殊实例 事件只能在类的内部触发执行
31 | public event EventHandler SendMsgEvent; //使用默认的事件处理委托
32 | #endregion
33 |
34 |
35 |
36 | public MainForm()
37 | {
38 | InitializeComponent();
39 | }
40 |
41 | private void ParentFrm_Load(object sender, EventArgs e)
42 | {
43 |
44 | #region 方法1(不推荐)
45 | //ObeserverFormA childFormA = new ObeserverFormA();
46 | //ChildFormA = childFormA;
47 | //childFormA.Show();
48 | //ObeserverFormB childFormB = new ObeserverFormB();
49 | //ChildFormB = childFormB;
50 | //childFormB.Show();
51 | #endregion
52 |
53 | #region 方法2---委托方式传值
54 | //子窗体弹出来之前,为委托赋值,关注主窗体消息的变化,当有多个窗体需要接收信息,只需要在此修改即可
55 | //ObeserverFormA childFormA = new ObeserverFormA();
56 | //SendMsg += childFormA.SetText;//委托赋值
57 | //childFormA.Show();
58 | //ObeserverFormB childFormB = new ObeserverFormB();
59 | //SendMsg += childFormB.SetText;
60 | //childFormB.Show();
61 | #endregion
62 |
63 |
64 | #region 方法3(推荐)--事件方式
65 | //子窗体弹出来之前,注册事件,关注主窗体消息的变化,当有多个窗体需要接收信息,只需要在此修改即可
66 | ObeserverFormA childFormA = new ObeserverFormA();
67 | SendMsgEvent += childFormA.MainFormTxtChaned;//为子窗体注册事件,在子窗体中事件处理代码中设置文本
68 | childFormA.Show();
69 | ObeserverFormB childFormB = new ObeserverFormB();
70 | SendMsgEvent += childFormB.MainFormTxtChaned;
71 | childFormB.Show();
72 | #endregion
73 |
74 |
75 |
76 | }
77 |
78 | //当MainForm中输入文本,点击发送消息,子窗体的文本框显示主窗体的数据
79 | private void btnSendMsg_Click(object sender, EventArgs e)
80 | {
81 | #region 方法1(不推荐)
82 |
83 | //ChildFormA.SetText(this.txtMsg.Text);
84 | //ChildFormB.SetText(this.txtMsg.Text);
85 |
86 | #endregion
87 |
88 | #region 方法2---委托方式传值
89 | //if (SendMsg!=null)
90 | //{
91 | // SendMsg(this.txtMsg.Text);//执行所有注册的委托
92 | //}
93 |
94 | #endregion
95 |
96 | #region 方法3(推荐)--事件方式
97 | //触发事件
98 | //EventArgs,写一个子类继承该类,子类中添加需要封装的数据信息,此处只需要传递string信息,详见MyEventArgs
99 | SendMsgEvent(this,new MyEventArg(){Text=this.txtMsg.Text});
100 | #endregion
101 | }
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/WinFrmDemo/MainForm.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/WinFrmDemo/MyEventArg.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace WinFrmDemo
8 | {
9 | public class MyEventArg :EventArgs
10 | {
11 | //传递主窗体的数据信息
12 | public string Text { get; set; }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/WinFrmDemo/ObeserverFormA.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace WinFrmDemo
2 | {
3 | partial class ObeserverFormA
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.txtMsg = new System.Windows.Forms.TextBox();
32 | this.label1 = new System.Windows.Forms.Label();
33 | this.SuspendLayout();
34 | //
35 | // txtMsg
36 | //
37 | this.txtMsg.Location = new System.Drawing.Point(216, 74);
38 | this.txtMsg.Name = "txtMsg";
39 | this.txtMsg.Size = new System.Drawing.Size(259, 21);
40 | this.txtMsg.TabIndex = 3;
41 | //
42 | // label1
43 | //
44 | this.label1.AutoSize = true;
45 | this.label1.Location = new System.Drawing.Point(67, 74);
46 | this.label1.Name = "label1";
47 | this.label1.Size = new System.Drawing.Size(143, 12);
48 | this.label1.TabIndex = 4;
49 | this.label1.Text = "A窗体收到的主窗体数据:";
50 | //
51 | // ObeserverFormA
52 | //
53 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
54 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
55 | this.ClientSize = new System.Drawing.Size(511, 390);
56 | this.Controls.Add(this.label1);
57 | this.Controls.Add(this.txtMsg);
58 | this.Name = "ObeserverFormA";
59 | this.Text = "ObeserverFormA";
60 | this.ResumeLayout(false);
61 | this.PerformLayout();
62 |
63 | }
64 |
65 | #endregion
66 |
67 | private System.Windows.Forms.TextBox txtMsg;
68 | private System.Windows.Forms.Label label1;
69 | }
70 | }
--------------------------------------------------------------------------------
/WinFrmDemo/ObeserverFormA.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace WinFrmDemo
12 | {
13 | public partial class ObeserverFormA : Form
14 | {
15 | ///
16 | /// 提供外部访问自己元素的方法
17 | ///
18 | ///
19 | public void SetText(string txt)
20 | {
21 | this.txtMsg.Text = txt;
22 | }
23 | public ObeserverFormA()
24 | {
25 | InitializeComponent();
26 | }
27 |
28 | public void AfterParentFrmTextChange(object sender, EventArgs e)
29 | {
30 | //拿到父窗体的传来的文本
31 | MyEventArg arg = e as MyEventArg;
32 | this.SetText(arg.Text);
33 | }
34 |
35 | internal void MainFormTxtChaned(object sender, EventArgs e)
36 | {
37 | //取到主窗体的传来的文本
38 | MyEventArg arg = e as MyEventArg;
39 | this.SetText(arg.Text);
40 |
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/WinFrmDemo/ObeserverFormA.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/WinFrmDemo/ObeserverFormB.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace WinFrmDemo
2 | {
3 | partial class ObeserverFormB
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.label1 = new System.Windows.Forms.Label();
32 | this.txtMsg = new System.Windows.Forms.TextBox();
33 | this.SuspendLayout();
34 | //
35 | // label1
36 | //
37 | this.label1.AutoSize = true;
38 | this.label1.Location = new System.Drawing.Point(39, 158);
39 | this.label1.Name = "label1";
40 | this.label1.Size = new System.Drawing.Size(143, 12);
41 | this.label1.TabIndex = 6;
42 | this.label1.Text = "B窗体收到的主窗体数据:";
43 | //
44 | // txtMsg
45 | //
46 | this.txtMsg.Location = new System.Drawing.Point(188, 158);
47 | this.txtMsg.Name = "txtMsg";
48 | this.txtMsg.Size = new System.Drawing.Size(259, 21);
49 | this.txtMsg.TabIndex = 5;
50 | //
51 | // ObeserverFormB
52 | //
53 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
54 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
55 | this.ClientSize = new System.Drawing.Size(486, 336);
56 | this.Controls.Add(this.label1);
57 | this.Controls.Add(this.txtMsg);
58 | this.Name = "ObeserverFormB";
59 | this.Text = "ObeserverFormB";
60 | this.ResumeLayout(false);
61 | this.PerformLayout();
62 |
63 | }
64 |
65 | #endregion
66 |
67 | private System.Windows.Forms.Label label1;
68 | private System.Windows.Forms.TextBox txtMsg;
69 | }
70 | }
--------------------------------------------------------------------------------
/WinFrmDemo/ObeserverFormB.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace WinFrmDemo
12 | {
13 | public partial class ObeserverFormB : Form
14 | {
15 |
16 |
17 |
18 | public ObeserverFormB()
19 | {
20 | InitializeComponent();
21 | }
22 |
23 |
24 |
25 | ///
26 | /// 提供外部访问自己元素的方法
27 | ///
28 | ///
29 | public void SetText(string txt)
30 | {
31 | this.txtMsg.Text = txt;
32 | }
33 |
34 |
35 |
36 | internal void MainFormTxtChaned(object sender, EventArgs e)
37 | {
38 | //取到主窗体的传来的文本
39 | MyEventArg arg = e as MyEventArg;
40 | this.SetText(arg.Text);
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/WinFrmDemo/ObeserverFormB.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/WinFrmDemo/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace WinFrmDemo
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// 应用程序的主入口点。
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new MainForm());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/WinFrmDemo/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的常规信息通过以下
6 | // 特性集控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("WinFrmDemo")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("WinFrmDemo")]
13 | [assembly: AssemblyCopyright("Copyright © 2013")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // 将 ComVisible 设置为 false 使此程序集中的类型
18 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
19 | // 则将该类型上的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("85a9d27f-4b23-4843-a749-4453e4aeb597")]
24 |
25 | // 程序集的版本信息由下面四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
33 | // 方法是按如下所示使用“*”:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/WinFrmDemo/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本: 4.0.30319.34003
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace WinFrmDemo.Properties
12 | {
13 |
14 |
15 | ///
16 | /// 一个强类型的资源类,用于查找本地化的字符串等。
17 | ///
18 | // 此类是由 StronglyTypedResourceBuilder
19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
20 | // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
21 | // (以 /str 作为命令选项),或重新生成 VS 项目。
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// 返回此类使用的、缓存的 ResourceManager 实例。
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WinFrmDemo.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// 为所有资源查找重写当前线程的 CurrentUICulture 属性,
56 | /// 方法是使用此强类型资源类。
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/WinFrmDemo/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/WinFrmDemo/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.34003
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace WinFrmDemo.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/WinFrmDemo/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/WinFrmDemo/WinFormTransValueDemo.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {98DD3650-6BB9-41C3-BE96-F7E8FABD8EDD}
8 | WinExe
9 | Properties
10 | WinFrmDemo
11 | WinFrmDemo
12 | v4.5
13 | 512
14 | 发布\
15 | true
16 | Disk
17 | false
18 | Foreground
19 | 7
20 | Days
21 | false
22 | false
23 | true
24 | 0
25 | 1.0.0.%2a
26 | false
27 | false
28 | true
29 |
30 |
31 | AnyCPU
32 | true
33 | full
34 | false
35 | bin\Debug\
36 | DEBUG;TRACE
37 | prompt
38 | 4
39 |
40 |
41 | AnyCPU
42 | pdbonly
43 | true
44 | bin\Release\
45 | TRACE
46 | prompt
47 | 4
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 | Form
64 |
65 |
66 | ObeserverFormA.cs
67 |
68 |
69 | Form
70 |
71 |
72 | MainForm.cs
73 |
74 |
75 | Form
76 |
77 |
78 | ObeserverFormB.cs
79 |
80 |
81 |
82 |
83 |
84 | ObeserverFormA.cs
85 |
86 |
87 | MainForm.cs
88 |
89 |
90 | ObeserverFormB.cs
91 |
92 |
93 | ResXFileCodeGenerator
94 | Resources.Designer.cs
95 | Designer
96 |
97 |
98 | True
99 | Resources.resx
100 |
101 |
102 | SettingsSingleFileGenerator
103 | Settings.Designer.cs
104 |
105 |
106 | True
107 | Settings.settings
108 | True
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 | False
117 | Microsoft .NET Framework 4.5 %28x86 和 x64%29
118 | true
119 |
120 |
121 | False
122 | .NET Framework 3.5 SP1 Client Profile
123 | false
124 |
125 |
126 | False
127 | .NET Framework 3.5 SP1
128 | false
129 |
130 |
131 |
132 |
139 |
--------------------------------------------------------------------------------