TheSwamp

Code Red => .NET => Topic started by: itcad on June 04, 2009, 11:46:30 PM

Title: How to use "AutoCAD Dockable Container" in C#?
Post by: itcad on June 04, 2009, 11:46:30 PM
How to use "AutoCAD Dockable Container" in C#?
reference:   http://www.jrl-e.com/index.htm

Who can tell me?

Below is an example of a VB implemented IRetrieveDockableContainer:

‘ Global variable so the interface can be used at a later time if needed.
Dim dockContainer As AcadDockableContainer
Implements IRetrieveDockableContainer

Private Sub IRetrieveDockableContainer_SetDockContainer(ByVal newVal As IAcadDockableContainer)
   ‘ Keep this interface around by assigning it to a global variable.
   Set dockContainer = newVal

   ‘ Allow docking only on the left and right sides of AutoCAD
   dockContainer.EnableDockPositions = acDockLeft + acDockRight

   ‘ We want the window to appear as a floating window the very first time.
   ‘ The size of the floating window is specified below.
   Dim rect(0 To 3) As Integer
   rect(0) = 50 ' left
   rect(1) = 50 ' top
   rect(2) = 300 ' right
   rect(3) = 300 ' bottom

   dockContainer.SetPreferredDockPosition acFloating, rect
End Sub

How to write these in c#?
Title: Re: How to use "AutoCAD Dockable Container" in C#?
Post by: Bobby C. Jones on June 05, 2009, 09:10:06 AM
Well, variable declarations go from this form

Code: [Select]
Dim dockContainer As AcadDockableContainer
to this form

Code: [Select]
AcadDockableContainer dockContainer;
and the array declaration would look like this

Code: [Select]
int[] rect = {50, 50, 300, 300};
and the other translation issues are just as minor.  This leads me to believe that your question is deeper than a simple translation issue.  And not to take anything away from Jorge's hard work, but couldn't you just use a palette?

How to use "AutoCAD Dockable Container" in C#?
reference:   http://www.jrl-e.com/index.htm

Who can tell me?

Below is an example of a VB implemented IRetrieveDockableContainer:

‘ Global variable so the interface can be used at a later time if needed.
Dim dockContainer As AcadDockableContainer
Implements IRetrieveDockableContainer

Private Sub IRetrieveDockableContainer_SetDockContainer(ByVal newVal As IAcadDockableContainer)
   ‘ Keep this interface around by assigning it to a global variable.
   Set dockContainer = newVal

   ‘ Allow docking only on the left and right sides of AutoCAD
   dockContainer.EnableDockPositions = acDockLeft + acDockRight

   ‘ We want the window to appear as a floating window the very first time.
   ‘ The size of the floating window is specified below.
   Dim rect(0 To 3) As Integer
   rect(0) = 50 ' left
   rect(1) = 50 ' top
   rect(2) = 300 ' right
   rect(3) = 300 ' bottom

   dockContainer.SetPreferredDockPosition acFloating, rect
End Sub

How to write these in c#?