• 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;
            }
    
    
        }
    }
    对话框
  • 相关阅读:
    poj 2478 Farey Sequence
    “玲珑杯”第七届郑州轻工业学院ACM程序设计大赛 ------- D:社交网络
    bnu oj 13288 Bi-shoe and Phi-shoe
    uva 11029 Leading and Trailing
    hdu 1198 Farm Irrigation
    hdu 4965 Fast Matrix Calculation
    Preparing Olympiad---cf550B(DFS或者状态压缩模板)
    squee_spoon and his Cube VI---郑大校赛(求最长子串)
    确定比赛名次---hdu1285(拓扑排序)
    Buy the souvenirs---hdu2126(01背包输出方案数)
  • 原文地址:https://www.cnblogs.com/minhost/p/5787205.html
Copyright © 2020-2023  润新知