Revit 2011二次开发“弹出对话框,得到输入的值”
2011-03-11 15:25
357 查看
新建一个窗体FrmDlg.cs
编辑框txtVal
按钮btnOk
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace RevitCodes
{
public partial class FrmDlg : Form
{
public string Val
{
get { return txtVal.Text; }
set { txtVal.Text = value; }
}
public FrmDlg()
{
InitializeComponent();
}
private void btnOk_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.OK;
}
}
}调用
#region 弹出对话框,得到输入的值
[Transaction(TransactionMode.Manual)]
[Regeneration(RegenerationOption.Manual)]
public class GetDialogValue : IExternalCommand
{
public Result Execute(ExternalCommandData commandData, ref string messages, ElementSet elements)
{
FrmDlg frmDlg = new FrmDlg();
frmDlg.ShowDialog();
if (frmDlg.DialogResult == DialogResult.OK)
{
MessageBox.Show("得到的值为:\n" + frmDlg.Val);
}
frmDlg.Dispose();
return Result.Succeeded;
}
}
#endregion
编辑框txtVal
按钮btnOk
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace RevitCodes
{
public partial class FrmDlg : Form
{
public string Val
{
get { return txtVal.Text; }
set { txtVal.Text = value; }
}
public FrmDlg()
{
InitializeComponent();
}
private void btnOk_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.OK;
}
}
}调用
#region 弹出对话框,得到输入的值
[Transaction(TransactionMode.Manual)]
[Regeneration(RegenerationOption.Manual)]
public class GetDialogValue : IExternalCommand
{
public Result Execute(ExternalCommandData commandData, ref string messages, ElementSet elements)
{
FrmDlg frmDlg = new FrmDlg();
frmDlg.ShowDialog();
if (frmDlg.DialogResult == DialogResult.OK)
{
MessageBox.Show("得到的值为:\n" + frmDlg.Val);
}
frmDlg.Dispose();
return Result.Succeeded;
}
}
#endregion
相关文章推荐
- 近期.NET学习及项目开发整理-弹出对话框显示 是否 然后得到 选择的结果
- Revit 2011二次开发之得到选择的对象
- Android开发 之 监听返回键,弹出一个退出对话框
- 安卓开发 弹出对话框,然后自动消失
- Android开发使输入框点击弹出日期选择对话框的方法
- Web开发中的弹出对话框控件介绍
- Air for Android开发中使用Back键弹出是否退出对话框
- 每日学习心得:CustomValidator验证控件验证用户输入的字符长度、Linq 多字段分组统计、ASP.NET后台弹出confirm对话框,然后点击确定,执行一段代码
- 输入“\”或“.”的时候弹出选择对话框,让你选择?
- android开发EditText输入时弹出数字输入键盘
- 【android开发】弹出对话框_1
- iOS项目开发实战——弹出提示对话框
- FTP无弹出用户名及密码输入对话框
- 弹出对话框 用户输入值(FM)
- android开发之使edittext输入弹出数字软键盘。亲测可用。手机号登陆注册常用。
- Web开发中的弹出对话框控件介绍
- win8开发(17)——自己也来做一做弹出对话框
- outlook 一直弹出对话框要求输入密码
- 【android开发】弹出对话框_2
- 在网页输入汉字时弹出启动对话框,原来是IETool.dll等捣鬼