.NET

Reply
Valued Contributor
mrevelli
Posts: 84
Registered: ‎10-21-2003
Message 1 of 2 (101 Views)

Autocad 2006 & StatusBarItem

101 Views, 1 Replies
01-31-2006 01:12 AM
Hey all,
I need to add a Pane to the Application statusbar
Any example to use class Autodesk.AutoCAD.Windows.StatusBarItem ?
Thanks a lot in advance
Max
*Bobby C. Jones
Message 2 of 2 (101 Views)

Re: Autocad 2006 & StatusBarItem

01-31-2006 06:05 AM in reply to: mrevelli
Here is an example of adding panes to both the application and the document
status bars.

using System;

using Autodesk.AutoCAD.Runtime;

using Autodesk.AutoCAD.ApplicationServices;

using acadApp = Autodesk.AutoCAD.ApplicationServices.Application;

using Autodesk.AutoCAD.Windows;

namespace AU2005.AcadApi

{

//Pages 7 & 8

public class PaneButtonsExample

{

#region Application Pane

[CommandMethod("CreateAppPane")]

public static void AddApplicationPane()

{

Pane au2005AppPaneButton = new Pane();

//Set the buttons properties

au2005AppPaneButton.Enabled = true;

au2005AppPaneButton.Visible = true;

au2005AppPaneButton.Style = PaneStyles.Normal;

au2005AppPaneButton.Text = "AU2005 App. Pane";

au2005AppPaneButton.ToolTipText = "Welcome to Autodesk University 2005!";

//Hook into the MouseDown event to run code when the button is pressed.

au2005AppPaneButton.MouseDown += new
StatusBarMouseDownEventHandler(OnAppMouseDown);

//Add the button to the applications status bar

//Items can also be added to the tray area

acadApp.StatusBar.Panes.Add(au2005AppPaneButton);

}



private static void OnAppMouseDown(object sender,
StatusBarMouseDownEventArgs e)

{

Pane paneButton = (Pane) sender;

string alertMessage;

if (paneButton.Style == PaneStyles.PopOut)

{

paneButton.Style = PaneStyles.Normal;

alertMessage = "The application button is activated.";

}

else

{

paneButton.Style = PaneStyles.PopOut;

alertMessage = "The application button is de-activated.";

}

acadApp.StatusBar.Update();

acadApp.ShowAlertDialog(alertMessage);

}

#endregion



//Document pane code not shown in the handout

#region Document Pane

[CommandMethod("CreateDocPane")]

public static void AddDocumentPane()

{

Pane au2005DocPaneButton = new Pane();

//Set the buttons properties

au2005DocPaneButton.Enabled = true;

au2005DocPaneButton.Visible = true;

au2005DocPaneButton.Style = PaneStyles.Normal;

au2005DocPaneButton.Text = "AU2005 Doc. Pane";

au2005DocPaneButton.ToolTipText = "Welcome to Autodesk University 2005!";

//Hook into the MouseDown event to run code when the button is pressed.

au2005DocPaneButton.MouseDown += new
StatusBarMouseDownEventHandler(OnDocMouseDown);

//Add the button to the documents status bar

acadApp.DocumentManager.MdiActiveDocument.StatusBar.Panes.Add(au2005DocPaneButton);

}



private static void OnDocMouseDown(object sender,
StatusBarMouseDownEventArgs e)

{

Pane paneButton = (Pane) sender;

string alertMessage;

if (paneButton.Style == PaneStyles.PopOut)

{

paneButton.Style = PaneStyles.Normal;

alertMessage = "The document button is activated.";

}

else

{

paneButton.Style = PaneStyles.PopOut;

alertMessage = "The document button is de-activated.";

}

acadApp.DocumentManager.MdiActiveDocument.StatusBar.Update();

acadApp.ShowAlertDialog(alertMessage);

}

#endregion

}

}
--
Bobby C. Jones
http://www.acadx.com

wrote in message news:5072891@discussion.autodesk.com...
Hey all,
I need to add a Pane to the Application statusbar
Any example to use class Autodesk.AutoCAD.Windows.StatusBarItem ?
Thanks a lot in advance
Max
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!