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; } } }
对话框
时间: 2024-11-10 07:27:34