As promised, I am going to post the code from my AU class this year. This was meant as a high level overview, so most of the code isn't real in depth.
This first example shows how to add tabs to the Options dialog box. You will need to create a user control in order for this to work. This code uses a control named "Au2005UserControl".
The drafting settings and customization dialogs can also host user defined controls.
using System;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using acadApp = Autodesk.AutoCAD.ApplicationServices.Application;
using AU2005.AcadApi;
namespace AU2005.AcadApi
{
//Pages 5 & 6 in the handout
public class OptionsDialogTabExample
{
//This method tells Autocad to run the OnDisplayingOptionsDialog method
//when the DisplayingOptionsDialog event is fired
[CommandMethod("CreateNewOptionsTab")]
public void AddNewOptionsTab()
{
acadApp.DisplayingOptionDialog += new TabbedDialogEventHandler(OnDisplayingOptionDialog);
//The Drafting Settings and Customization dialogs can also be captured
}
//This is the method that adds the tab and places the user control on it
private void OnDisplayingOptionDialog(object sender, TabbedDialogEventArgs e)
{
//Create an instance of the user control
Au2005UserControl AuOptionsTab = new Au2005UserControl();
//Add actions for the Ok button
//Actions can also be added for Cancel and Help
TabbedDialogAction onOkPress = new TabbedDialogAction(OnOk);
//Add the tab, the user control, and Ok/Cancel/Help handlers.
e.AddTab("AutoDesk University 2005", new TabbedDialogExtension(AuOptionsTab, onOkPress));
}
//This method runs when the Ok button on the Options dialog is pressed.
//It will run even if they never open the custom tab.
public void OnOk()
{
acadApp.ShowAlertDialog ("Ok Pressed.\nSee you at AU 2006!");
}
}
}