TheSwamp
Code Red => .NET => Topic started by: Bobby C. Jones on December 28, 2005, 02:22:37 PM
-
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!");
}
}
}
-
Hey! I remember this!
Bobby, I enjoyed your class at AU. Good stuff, although still a tad over my head.
-
Hey! I remember this!
Bobby, I enjoyed your class at AU. Good stuff, although still a tad over my head.
Hi Birdy, I'm glad that you enjoyed it. I did too!
When I feel that I'm in over my head with this stuff I just pick a project and dive in head first. I'm currently working on my project list for the upcoming year and I expect to be totally immersed in this for quite some time, like it or not. Fortunately, I do :-)
-
Thanks for posting these Bobby. These will be very handy for a lot of the people who weren't able to visit AU and who don't have Subscriptions. The ADN will not make the lessons available either, which I found dissapointing in regard their supporting an emerging technology.
I hope that some of our visitors are encouraged by these lessons to participate in helping to build our knowledgebase. Every little bit counts.
-
I hope that some of our visitors are encouraged by these lessons to participate in helping to build our knowledgebase. Every little bit counts.
Hi Kerry;
What is the compiler you have?
-
Hi Luis
VB6
VS2003 C# only
VS2005 Express ALL
VS2005 Pro
-
Luis:
All .NET compilers are free in the SDK.
-
Luis:
All .NET compilers are free in the SDK.
Thank you Tim, I think is time to try C#... [any issues of having VS.NET 7.0 with new compiler versions ? or recomendations ?]
-
Luis:
All .NET compilers are free in the SDK.
Thank you Tim, I think is time to try C#... [any issues of having VS.NET 7.0 with new compiler versions ? or recomendations ?]
I can't really answer that as I don't use Visual Studio. I've tried the express editions but didn't really like them. However, I'm a big fan of Sharpdevelop (http://www.icsharpcode.net/OpenSource/SD/Default.aspx).
-
Thank you Tim, I think is time to try C#... [any issues of having VS.NET 7.0 with new compiler versions ? or recomendations ?]
Hey Luis,
I have VS2003 & VS2005 installed and running side by side w/o any problems.
-
Hey Luis,
I have VS2003 & VS2005 installed and running side by side w/o any problems.
Thank you Bobby;
I use the VSC++ .NET 2002 Standard version for what I write on C++ and ObjectARX, I have never had tried to do anything on C#, for what I have seen and reading it is very similar the code.... will see.
Again thanks.
-
VS2005 express... I cannot installed on my PC here at my office, it has XP Home Edition... so does not qualify for the service pack 2 required.... :cry:
-
VS2005 express... I cannot installed on my PC here at my office, it has XP Home Edition... so does not qualify for the service pack 2 required.... :cry:
Try SharpDevelop (http://www.icsharpcode.net/OpenSource/SD/Default.aspx).
-
Try SharpDevelop (http://www.icsharpcode.net/OpenSource/SD/Default.aspx).
Yes, I have that one Tim... I just want to use the SLN projects, from samples I have...
Thanks.
-
I'm using SharpDevelop 2 with .NET 2 and I can open VS2003 sln files.
-
I'm using SharpDevelop 2 with .NET 2 and I can open VS2003 sln files.
Strange... the version I downloaded the other day... on the same link you gave me... is 1.1.... ok, I know why...
-
Now, that I see this new IDE for SharpDevelop, man is seems that MFC is much simpler.... all just for the dialog boxes... hmmmm..... OK, I need to read a lot... I am now out of scope here... I open one SLN and cannot even being able to view the forms.... no no no.... :lol:
On the mean time, has anyone here have been able to run a unmanaged ARX code, with C#... or better a sample of using both?
-
If you open a sln that has a control referenced from an unavailable assembly you will not be able to view the form.
-
If you open a sln that has a control referenced from an unavailable assembly you will not be able to view the form.
Now in Spanish please.... :roll:
-
Si usted se abre un sln que tiene un control referido de una asamblea inasequible usted no podrá visión la forma.
- note: Babelfish doesn't work well.