Creates an in-canvas control.
Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 24.0.0.0 (24.0.0.0)
Since: 2022
Syntax
C# |
---|
|
Visual Basic |
---|
|
Visual C++ |
---|
|
Parameters
- data
- Type: Autodesk.Revit.DBInCanvasControlData
Data to generate in-canvas control appearance.
- ownerViewId
- Type: Autodesk.Revit.DBElementId
The view in which the control appears. It will show in all views if the id is invalidElementId.
Return Value
Unique index of control for future references.Remarks
This method can perform drawing an image (supplied by the caller) as an in-canvas control in the view(s). The control can react on click by invoking a callback defined in [!:Autodesk::Revit::UI::ITemporaryGraphicsHandler::OnClick(TemporaryGraphicsCommandData)]. The caller can use the returned index to update the control (changing image/location), delete and change visibility (hide/unhide) in response to any events later.
Exceptions
Exception | Condition |
---|---|
Autodesk.Revit.ExceptionsArgumentException | The ownerViewId provided is not an id of a view. |
Autodesk.Revit.ExceptionsArgumentNullException | A non-optional argument was null |
Autodesk.Revit.ExceptionsInvalidOperationException | Failed to load the image from specified path. |