窗体设计器:工具箱、拖放、属性与事件窗口,读写 VS 格式的 Designer.cs

- Designer.cs 在浏览器端解析为语句列表,未改动的语句保留原文:
  教材 25 个参考窗体和全部示例读入再写出逐字节不变
- 编辑操作:添加 / 删除 / 移动 / 改名控件、属性、事件、列表项;
  布局语句增删规则与 VS 一致(对全部现有文件执行无变化)
- 双击控件或事件:绑定事件并在窗体代码末尾插入处理方法,跳到代码
- 预览复用运行时的 ControlView,设计时与运行时外观一致
- 修正:窗体属性 this.ClientSize = new Size(...) 被误认成创建控件;
  示例 Designer.cs 的块头注释改为 VS 的 "// " 格式
- 测试:73 个(读写往返、布局规则、编辑操作、插入事件处理方法)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
xuyueandClaude Opus 5.5 committed 2026-10-22 11:11:48 +08:00
1 parent 03e80ce2e2
commit ea5a25af06
20 files changed
+2767 -132

No files matched your search

+18 -18
View File
@@ -38,16 +38,16 @@ namespace LED显示屏
this.label1 = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
//
// led
//
//
this.led.Location = new System.Drawing.Point(12, 12);
this.led.Name = "led";
this.led.Size = new System.Drawing.Size(750, 121);
this.led.TabIndex = 0;
//
//
// groupBox1
//
//
this.groupBox1.Controls.Add(this.com_Port);
this.groupBox1.Controls.Add(this.btn_Send);
this.groupBox1.Controls.Add(this.label2);
@@ -60,18 +60,18 @@ namespace LED显示屏
this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "LED控制";
//
//
// com_Port
//
//
this.com_Port.FormattingEnabled = true;
this.com_Port.Location = new System.Drawing.Point(101, 24);
this.com_Port.Name = "com_Port";
this.com_Port.Size = new System.Drawing.Size(173, 20);
this.com_Port.TabIndex = 6;
this.com_Port.Click += new System.EventHandler(this.com_Port_Click);
//
//
// btn_Send
//
//
this.btn_Send.Location = new System.Drawing.Point(301, 91);
this.btn_Send.Name = "btn_Send";
this.btn_Send.Size = new System.Drawing.Size(75, 23);
@@ -79,25 +79,25 @@ namespace LED显示屏
this.btn_Send.Text = "推 送";
this.btn_Send.UseVisualStyleBackColor = true;
this.btn_Send.Click += new System.EventHandler(this.btn_Send_Click);
//
//
// label2
//
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(16, 67);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(71, 12);
this.label2.TabIndex = 4;
this.label2.Text = "推送LED信息";
//
//
// txt_SendText
//
//
this.txt_SendText.Location = new System.Drawing.Point(101, 64);
this.txt_SendText.Name = "txt_SendText";
this.txt_SendText.Size = new System.Drawing.Size(286, 21);
this.txt_SendText.TabIndex = 3;
//
//
// btn_Open
//
//
this.btn_Open.Location = new System.Drawing.Point(301, 20);
this.btn_Open.Name = "btn_Open";
this.btn_Open.Size = new System.Drawing.Size(86, 23);
@@ -105,18 +105,18 @@ namespace LED显示屏
this.btn_Open.Text = "打 开";
this.btn_Open.UseVisualStyleBackColor = true;
this.btn_Open.Click += new System.EventHandler(this.btn_Open_Click);
//
//
// label1
//
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(16, 23);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(71, 12);
this.label1.TabIndex = 0;
this.label1.Text = "串 口";
//
//
// Form1
//
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(774, 308);
+26 -26
View File
@@ -43,9 +43,9 @@ namespace 模拟量采集
this.grp_show.SuspendLayout();
this.grp_config.SuspendLayout();
this.SuspendLayout();
//
//
// grp_show
//
//
this.grp_show.Controls.Add(this.btn_get);
this.grp_show.Controls.Add(this.txt_humidity);
this.grp_show.Controls.Add(this.txt_temperature);
@@ -59,9 +59,9 @@ namespace 模拟量采集
this.grp_show.TabIndex = 0;
this.grp_show.TabStop = false;
this.grp_show.Text = "数据显示";
//
//
// btn_get
//
//
this.btn_get.Location = new System.Drawing.Point(209, 24);
this.btn_get.Name = "btn_get";
this.btn_get.Size = new System.Drawing.Size(39, 83);
@@ -69,57 +69,57 @@ namespace 模拟量采集
this.btn_get.Text = "获取";
this.btn_get.UseVisualStyleBackColor = true;
this.btn_get.Click += new System.EventHandler(this.btn_get_Click);
//
//
// txt_humidity
//
//
this.txt_humidity.Location = new System.Drawing.Point(83, 86);
this.txt_humidity.Name = "txt_humidity";
this.txt_humidity.Size = new System.Drawing.Size(100, 21);
this.txt_humidity.TabIndex = 5;
//
//
// txt_temperature
//
//
this.txt_temperature.Location = new System.Drawing.Point(83, 54);
this.txt_temperature.Name = "txt_temperature";
this.txt_temperature.Size = new System.Drawing.Size(100, 21);
this.txt_temperature.TabIndex = 4;
//
//
// txt_light
//
//
this.txt_light.Location = new System.Drawing.Point(83, 24);
this.txt_light.Name = "txt_light";
this.txt_light.Size = new System.Drawing.Size(100, 21);
this.txt_light.TabIndex = 3;
//
//
// lbl_humidity
//
//
this.lbl_humidity.AutoSize = true;
this.lbl_humidity.Location = new System.Drawing.Point(20, 89);
this.lbl_humidity.Name = "lbl_humidity";
this.lbl_humidity.Size = new System.Drawing.Size(29, 12);
this.lbl_humidity.TabIndex = 2;
this.lbl_humidity.Text = "湿度";
//
//
// lbl_temperature
//
//
this.lbl_temperature.AutoSize = true;
this.lbl_temperature.Location = new System.Drawing.Point(20, 57);
this.lbl_temperature.Name = "lbl_temperature";
this.lbl_temperature.Size = new System.Drawing.Size(29, 12);
this.lbl_temperature.TabIndex = 1;
this.lbl_temperature.Text = "温度";
//
//
// lbl_light
//
//
this.lbl_light.AutoSize = true;
this.lbl_light.Location = new System.Drawing.Point(20, 27);
this.lbl_light.Name = "lbl_light";
this.lbl_light.Size = new System.Drawing.Size(41, 12);
this.lbl_light.TabIndex = 0;
this.lbl_light.Text = "光照度";
//
//
// grp_config
//
//
this.grp_config.Controls.Add(this.btn_Open);
this.grp_config.Controls.Add(this.com_port);
this.grp_config.Controls.Add(this.lbl_port);
@@ -129,9 +129,9 @@ namespace 模拟量采集
this.grp_config.TabIndex = 1;
this.grp_config.TabStop = false;
this.grp_config.Text = "配置";
//
//
// btn_Open
//
//
this.btn_Open.Location = new System.Drawing.Point(149, 59);
this.btn_Open.Name = "btn_Open";
this.btn_Open.Size = new System.Drawing.Size(75, 23);
@@ -139,26 +139,26 @@ namespace 模拟量采集
this.btn_Open.Text = "开启";
this.btn_Open.UseVisualStyleBackColor = true;
this.btn_Open.Click += new System.EventHandler(this.btn_Open_Click);
//
//
// com_port
//
//
this.com_port.FormattingEnabled = true;
this.com_port.Location = new System.Drawing.Point(105, 33);
this.com_port.Name = "com_port";
this.com_port.Size = new System.Drawing.Size(119, 20);
this.com_port.TabIndex = 1;
//
//
// lbl_port
//
//
this.lbl_port.AutoSize = true;
this.lbl_port.Location = new System.Drawing.Point(44, 36);
this.lbl_port.Name = "lbl_port";
this.lbl_port.Size = new System.Drawing.Size(29, 12);
this.lbl_port.TabIndex = 0;
this.lbl_port.Text = "串口";
//
//
// frm_analog
//
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(284, 262);
+32 -32
View File
@@ -46,17 +46,17 @@ namespace LED推送模拟量
this.grp_show.SuspendLayout();
this.grp_config.SuspendLayout();
this.SuspendLayout();
//
//
// led
//
//
this.led.BackColor = System.Drawing.Color.Black;
this.led.Location = new System.Drawing.Point(19, 0);
this.led.Name = "led";
this.led.Size = new System.Drawing.Size(800, 130);
this.led.TabIndex = 0;
//
//
// grp_show
//
//
this.grp_show.Controls.Add(this.btn_get);
this.grp_show.Controls.Add(this.txt_temperature);
this.grp_show.Controls.Add(this.txt_humidity);
@@ -70,9 +70,9 @@ namespace LED推送模拟量
this.grp_show.TabIndex = 1;
this.grp_show.TabStop = false;
this.grp_show.Text = "数据显示";
//
//
// btn_get
//
//
this.btn_get.Location = new System.Drawing.Point(287, 47);
this.btn_get.Name = "btn_get";
this.btn_get.Size = new System.Drawing.Size(51, 103);
@@ -80,57 +80,57 @@ namespace LED推送模拟量
this.btn_get.Text = "获取";
this.btn_get.UseVisualStyleBackColor = true;
this.btn_get.Click += new System.EventHandler(this.btn_get_Click);
//
//
// txt_temperature
//
//
this.txt_temperature.Location = new System.Drawing.Point(105, 85);
this.txt_temperature.Name = "txt_temperature";
this.txt_temperature.Size = new System.Drawing.Size(147, 21);
this.txt_temperature.TabIndex = 4;
//
//
// txt_humidity
//
//
this.txt_humidity.Location = new System.Drawing.Point(105, 129);
this.txt_humidity.Name = "txt_humidity";
this.txt_humidity.Size = new System.Drawing.Size(147, 21);
this.txt_humidity.TabIndex = 5;
//
//
// txt_light
//
//
this.txt_light.Location = new System.Drawing.Point(105, 47);
this.txt_light.Name = "txt_light";
this.txt_light.Size = new System.Drawing.Size(147, 21);
this.txt_light.TabIndex = 3;
//
//
// lbl_humidity
//
//
this.lbl_humidity.AutoSize = true;
this.lbl_humidity.Location = new System.Drawing.Point(43, 132);
this.lbl_humidity.Name = "lbl_humidity";
this.lbl_humidity.Size = new System.Drawing.Size(29, 12);
this.lbl_humidity.TabIndex = 2;
this.lbl_humidity.Text = "湿度";
//
//
// lbl_temperature
//
//
this.lbl_temperature.AutoSize = true;
this.lbl_temperature.Location = new System.Drawing.Point(43, 88);
this.lbl_temperature.Name = "lbl_temperature";
this.lbl_temperature.Size = new System.Drawing.Size(29, 12);
this.lbl_temperature.TabIndex = 1;
this.lbl_temperature.Text = "温度";
//
//
// lbl_light
//
//
this.lbl_light.AutoSize = true;
this.lbl_light.Location = new System.Drawing.Point(43, 50);
this.lbl_light.Name = "lbl_light";
this.lbl_light.Size = new System.Drawing.Size(41, 12);
this.lbl_light.TabIndex = 0;
this.lbl_light.Text = "光照度";
//
//
// grp_config
//
//
this.grp_config.Controls.Add(this.com_ledPort);
this.grp_config.Controls.Add(this.lbl_ledPort);
this.grp_config.Controls.Add(this.btn_open);
@@ -142,26 +142,26 @@ namespace LED推送模拟量
this.grp_config.TabIndex = 2;
this.grp_config.TabStop = false;
this.grp_config.Text = "配置";
//
//
// com_ledPort
//
//
this.com_ledPort.FormattingEnabled = true;
this.com_ledPort.Location = new System.Drawing.Point(127, 84);
this.com_ledPort.Name = "com_ledPort";
this.com_ledPort.Size = new System.Drawing.Size(121, 20);
this.com_ledPort.TabIndex = 3;
//
//
// lbl_ledPort
//
//
this.lbl_ledPort.AutoSize = true;
this.lbl_ledPort.Location = new System.Drawing.Point(48, 87);
this.lbl_ledPort.Name = "lbl_ledPort";
this.lbl_ledPort.Size = new System.Drawing.Size(47, 12);
this.lbl_ledPort.TabIndex = 2;
this.lbl_ledPort.Text = "LED串口";
//
//
// btn_open
//
//
this.btn_open.Location = new System.Drawing.Point(173, 121);
this.btn_open.Name = "btn_open";
this.btn_open.Size = new System.Drawing.Size(75, 23);
@@ -169,26 +169,26 @@ namespace LED推送模拟量
this.btn_open.Text = "开启";
this.btn_open.UseVisualStyleBackColor = true;
this.btn_open.Click += new System.EventHandler(this.btn_open_Click);
//
//
// com_adamPort
//
//
this.com_adamPort.FormattingEnabled = true;
this.com_adamPort.Location = new System.Drawing.Point(127, 41);
this.com_adamPort.Name = "com_adamPort";
this.com_adamPort.Size = new System.Drawing.Size(121, 20);
this.com_adamPort.TabIndex = 1;
//
//
// lbl_adamPort
//
//
this.lbl_adamPort.AutoSize = true;
this.lbl_adamPort.Location = new System.Drawing.Point(46, 44);
this.lbl_adamPort.Name = "lbl_adamPort";
this.lbl_adamPort.Size = new System.Drawing.Size(65, 12);
this.lbl_adamPort.TabIndex = 0;
this.lbl_adamPort.Text = "模拟量串口";
//
//
// frm_LED
//
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(834, 380);
+16 -16
View File
@@ -37,17 +37,17 @@ namespace ZigBee路灯
this.lbl_Lamp = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
//
// lamp1
//
//
this.lamp1.BackColor = System.Drawing.Color.White;
this.lamp1.Location = new System.Drawing.Point(29, 28);
this.lamp1.Name = "lamp1";
this.lamp1.Size = new System.Drawing.Size(105, 185);
this.lamp1.TabIndex = 0;
//
//
// rb_Open
//
//
this.rb_Open.AutoSize = true;
this.rb_Open.Location = new System.Drawing.Point(29, 222);
this.rb_Open.Name = "rb_Open";
@@ -56,9 +56,9 @@ namespace ZigBee路灯
this.rb_Open.Text = "开";
this.rb_Open.UseVisualStyleBackColor = true;
this.rb_Open.CheckedChanged += new System.EventHandler(this.rb_Open_CheckedChanged);
//
//
// rb_Close
//
//
this.rb_Close.AutoSize = true;
this.rb_Close.Location = new System.Drawing.Point(99, 222);
this.rb_Close.Name = "rb_Close";
@@ -67,9 +67,9 @@ namespace ZigBee路灯
this.rb_Close.Text = "关";
this.rb_Close.UseVisualStyleBackColor = true;
this.rb_Close.CheckedChanged += new System.EventHandler(this.rb_Close_CheckedChanged);
//
//
// groupBox1
//
//
this.groupBox1.Controls.Add(this.btn_open);
this.groupBox1.Controls.Add(this.com_port);
this.groupBox1.Controls.Add(this.lbl_Lamp);
@@ -79,9 +79,9 @@ namespace ZigBee路灯
this.groupBox1.TabIndex = 3;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "配置";
//
//
// btn_open
//
//
this.btn_open.Location = new System.Drawing.Point(145, 77);
this.btn_open.Name = "btn_open";
this.btn_open.Size = new System.Drawing.Size(75, 23);
@@ -89,26 +89,26 @@ namespace ZigBee路灯
this.btn_open.Text = "打开";
this.btn_open.UseVisualStyleBackColor = true;
this.btn_open.Click += new System.EventHandler(this.btn_open_Click);
//
//
// com_port
//
//
this.com_port.FormattingEnabled = true;
this.com_port.Location = new System.Drawing.Point(90, 34);
this.com_port.Name = "com_port";
this.com_port.Size = new System.Drawing.Size(130, 20);
this.com_port.TabIndex = 1;
//
//
// lbl_Lamp
//
//
this.lbl_Lamp.AutoSize = true;
this.lbl_Lamp.Location = new System.Drawing.Point(21, 37);
this.lbl_Lamp.Name = "lbl_Lamp";
this.lbl_Lamp.Size = new System.Drawing.Size(29, 12);
this.lbl_Lamp.TabIndex = 0;
this.lbl_Lamp.Text = "路灯";
//
//
// Form1
//
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.White;
+24 -24
View File
@@ -42,17 +42,17 @@ namespace 人体红外ZigBee联动
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
//
// lamp1
//
//
this.lamp1.BackColor = System.Drawing.Color.White;
this.lamp1.Location = new System.Drawing.Point(32, 22);
this.lamp1.Name = "lamp1";
this.lamp1.Size = new System.Drawing.Size(105, 185);
this.lamp1.TabIndex = 0;
//
//
// btn_lampOpen
//
//
this.btn_lampOpen.Location = new System.Drawing.Point(32, 213);
this.btn_lampOpen.Name = "btn_lampOpen";
this.btn_lampOpen.Size = new System.Drawing.Size(33, 23);
@@ -60,9 +60,9 @@ namespace 人体红外ZigBee联动
this.btn_lampOpen.Text = "开";
this.btn_lampOpen.UseVisualStyleBackColor = true;
this.btn_lampOpen.Click += new System.EventHandler(this.btn_lampOpen_Click);
//
//
// btn_lampClose
//
//
this.btn_lampClose.Location = new System.Drawing.Point(104, 213);
this.btn_lampClose.Name = "btn_lampClose";
this.btn_lampClose.Size = new System.Drawing.Size(33, 23);
@@ -70,9 +70,9 @@ namespace 人体红外ZigBee联动
this.btn_lampClose.Text = "关";
this.btn_lampClose.UseVisualStyleBackColor = true;
this.btn_lampClose.Click += new System.EventHandler(this.btn_lampClose_Click);
//
//
// groupBox1
//
//
this.groupBox1.Controls.Add(this.ch_bodyInfrared);
this.groupBox1.Controls.Add(this.com_environment);
this.groupBox1.Controls.Add(this.lbl_environment);
@@ -85,9 +85,9 @@ namespace 人体红外ZigBee联动
this.groupBox1.TabIndex = 3;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "配置";
//
//
// ch_bodyInfrared
//
//
this.ch_bodyInfrared.AutoSize = true;
this.ch_bodyInfrared.Location = new System.Drawing.Point(25, 81);
this.ch_bodyInfrared.Name = "ch_bodyInfrared";
@@ -96,26 +96,26 @@ namespace 人体红外ZigBee联动
this.ch_bodyInfrared.Text = "人体开关";
this.ch_bodyInfrared.UseVisualStyleBackColor = true;
this.ch_bodyInfrared.Click += new System.EventHandler(this.ch_bodyInfrared_Click);
//
//
// com_environment
//
//
this.com_environment.FormattingEnabled = true;
this.com_environment.Location = new System.Drawing.Point(90, 51);
this.com_environment.Name = "com_environment";
this.com_environment.Size = new System.Drawing.Size(130, 20);
this.com_environment.TabIndex = 3;
//
//
// lbl_environment
//
//
this.lbl_environment.AutoSize = true;
this.lbl_environment.Location = new System.Drawing.Point(23, 54);
this.lbl_environment.Name = "lbl_environment";
this.lbl_environment.Size = new System.Drawing.Size(53, 12);
this.lbl_environment.TabIndex = 2;
this.lbl_environment.Text = "环境采集";
//
//
// btn_open
//
//
this.btn_open.Location = new System.Drawing.Point(145, 77);
this.btn_open.Name = "btn_open";
this.btn_open.Size = new System.Drawing.Size(75, 23);
@@ -123,31 +123,31 @@ namespace 人体红外ZigBee联动
this.btn_open.Text = "打开";
this.btn_open.UseVisualStyleBackColor = true;
this.btn_open.Click += new System.EventHandler(this.btn_open_Click);
//
//
// com_lamp
//
//
this.com_lamp.FormattingEnabled = true;
this.com_lamp.Location = new System.Drawing.Point(90, 26);
this.com_lamp.Name = "com_lamp";
this.com_lamp.Size = new System.Drawing.Size(130, 20);
this.com_lamp.TabIndex = 1;
//
//
// lbl_lamp
//
//
this.lbl_lamp.AutoSize = true;
this.lbl_lamp.Location = new System.Drawing.Point(21, 29);
this.lbl_lamp.Name = "lbl_lamp";
this.lbl_lamp.Size = new System.Drawing.Size(29, 12);
this.lbl_lamp.TabIndex = 0;
this.lbl_lamp.Text = "路灯";
//
//
// timer1
//
//
this.timer1.Interval = 5000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
//
// Form1
//
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.White;