• Revit二次开发之一 Hello TaskDialog


    Revit中显示,如下对话框,

    using System;
    using System.Collections.Generic;
    using System.Text;
    using Autodesk.Revit;
    using Autodesk.Revit.DB;
    using Autodesk.Revit.UI;
    using Autodesk.Revit.ApplicationServices;
    
    namespace Revit.SDK.Samples.HelloRevit.CS
    {
        public class Command : IExternalCommand
        {
    
            public Autodesk.Revit.UI.Result Execute(ExternalCommandData commandData,
                ref string message, Autodesk.Revit.DB.ElementSet elements)
            {
              
                Application app = commandData.Application.Application;
                Document activeDoc = commandData.Application.ActiveUIDocument.Document;
                //创建一个对话框
                TaskDialog mainDialog = new TaskDialog("你好, Revit!");
                //显示标题
                mainDialog.MainInstruction = "你好, Revit!";
                //显示对话框的内容
                mainDialog.MainContent ="这是一个对话框的案例";
                //在对话框中添加链接,总共可以添加5个
                mainDialog.AddCommandLink(TaskDialogCommandLinkId.CommandLink1,
                                          "链接1");
                mainDialog.AddCommandLink(TaskDialogCommandLinkId.CommandLink2,
                                          "链接2");
                // 设置显示的按钮
                mainDialog.CommonButtons = TaskDialogCommonButtons.Close;
                mainDialog.DefaultButton = TaskDialogResult.Close;
    
                //底部显示的文字,可以是HTML
                mainDialog.FooterText =
                    "<a href=\"http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=2484975 \">"
                    + "进入revit开发中心</a>";
    
                TaskDialogResult tResult = mainDialog.Show();
    
                //判断用户点击的按钮
                if (TaskDialogResult.CommandLink1 == tResult)
                {
                    TaskDialog dialog_CommandLink1 = new TaskDialog("链接1被点击");
                    dialog_CommandLink1.MainInstruction = "链接1";
                    dialog_CommandLink1.Show();
    
                }
    
                else if (TaskDialogResult.CommandLink2 == tResult)
                {
                    TaskDialog.Show("链接2被点击", "链接2");
                }
      
    
                return Autodesk.Revit.UI.Result.Succeeded;
            }
    
    
        }
    }
    对话框
  • 相关阅读:
    树莓派.安装Firefox浏览器
    树莓派.Raspberry Pi 3碰到"Unable to determine hardware version. I see: Hardware : BCM2835"错误的解决过程
    Linux.Centos6编译安装nginx
    树莓派.桌面分辨率设置
    [转]树莓派.设置自动重连WiFi
    树莓派.系统.官方下载中NOOBS和Raspbian的区别
    树莓派.设置无线网卡为AP工作模式(pi2和pi3)
    Nodejs.调用Linux命令
    树莓派.屏幕休眠控制
    GO语言.树莓派.环境安装和测试
  • 原文地址:https://www.cnblogs.com/minhost/p/5787205.html
Copyright © 2020-2023  润新知