Chinaunix首页 | 论坛 | 博客
  • 博客访问: 251630
  • 博文数量: 45
  • 博客积分: 170
  • 博客等级: 入伍新兵
  • 技术积分: 488
  • 用 户 组: 普通用户
  • 注册时间: 2012-09-13 14:43
文章分类

全部博文(45)

文章存档

2014年(2)

2013年(35)

2012年(8)

我的朋友

分类: C#/.net

2013-06-05 22:04:52

父窗体:

点击(此处)折叠或打开

  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.Windows.Forms;

  9. namespace NCFileReadAndDisplay
  10. {
  11.     public partial class Form1 : Form
  12.     {
  13.         string ncInfo="";
  14.         public Form1()
  15.         {
  16.             InitializeComponent();
  17.         }
  18.         public string nc_format_info
  19.         {
  20.             get { return this.ncInfo; }
  21.             set { this.ncInfo = value; }
  22.         }
  23.         private void toolStripLabel1_Click(object sender, EventArgs e)//NC文件读取
  24.         {
  25.             NCFormatInfo ncfi = new NCFormatInfo();
  26.             ncfi.Owner = this;
  27.             ncfi.ShowDialog();
  28.             MessageBox.Show(ncInfo);
  29.         }
  30.     }
  31. }
子窗体:

点击(此处)折叠或打开

  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.Windows.Forms;

  9. namespace NCFileReadAndDisplay
  10. {
  11.     public partial class NCFormatInfo : Form
  12.     {
  13.         public NCFormatInfo()
  14.         {
  15.             InitializeComponent();
  16.         }
  17.         
  18.         private void button1_Click(object sender, EventArgs e)
  19.         {
  20.             Form1 form = (Form1)this.Owner;
  21.             form.nc_format_info = textBox1.Text + "," + textBox2.Text + "," + textBox3.Text;
  22.             this.Close();
  23.         }
  24.     }
  25. }

阅读(2778) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~