The PushButton object represents an button on a RibbonPanel.
Namespace:
Autodesk.Revit.UI
Assembly:
RevitAPIUI
(in RevitAPIUI.dll) Version: 21.0.0.0 (21.1.1.109)
Syntax
C# |
---|
|
Visual Basic |
---|
|
Visual C++ |
---|
|
Remarks
Use of this class is not supported in Revit Macros.
Examples
Copy
C#
private void AddPushButton(RibbonPanel panel)
{
PushButton pushButton = panel.AddItem(new PushButtonData("HelloWorld",
"HelloWorld", @"D:\Sample\HelloWorld\bin\Debug\HelloWorld.dll", "HelloWorld.CsHelloWorld")) as PushButton;
// Set ToolTip and contextual help
pushButton.ToolTip = "Say Hello World";
ContextualHelp contextHelp = new ContextualHelp(ContextualHelpType.Url,
"http://www.autodesk.com");
pushButton.SetContextualHelp(contextHelp);
// Set the large image shown on button
pushButton.LargeImage =
new BitmapImage(new Uri(@"D:\Sample\HelloWorld\bin\Debug\39-Globe_32x32.png"));
}
Copy
VB.NET
Private Sub AddPushButton(panel As RibbonPanel)
Dim pushButton As PushButton = TryCast(panel.AddItem(New PushButtonData("HelloWorld", "HelloWorld", "D:\Sample\HelloWorld\bin\Debug\HelloWorld.dll", "HelloWorld.CsHelloWorld")), PushButton)
' Set ToolTip and contextual help
pushButton.ToolTip = "Say Hello World"
Dim contextHelp As New ContextualHelp(ContextualHelpType.Url, "http://www.autodesk.com")
pushButton.SetContextualHelp(contextHelp)
' Set the large image shown on button
pushButton.LargeImage = New BitmapImage(New Uri("D:\Sample\HelloWorld\bin\Debug\39-Globe_32x32.png"))
End Sub
Inheritance Hierarchy
System
Object
Autodesk.Revit.UI RibbonItem
Autodesk.Revit.UI RibbonButton
Autodesk.Revit.UI PushButton
Autodesk.Revit.UI ToggleButton
Autodesk.Revit.UI RibbonItem
Autodesk.Revit.UI RibbonButton
Autodesk.Revit.UI PushButton
Autodesk.Revit.UI ToggleButton