I'm sure you could go about this in many different ways. However, here are a couple of suggestions that may help.My simple test contains a dockable window named DockableWindow1 that contains a single child control named button1. It also contains a seperate button that's used to find the dockable window and access its child controls.For a dockable window AddIn:1) In the implementation class of the dockable window (AddinImpl) expose a propertypublic DockableWindow1 MyDockWin { get {return m_windowUI;} }2) When accessing the dockable window from the separate button:string dockWinId = ThisAddIn.IDs.DockableWindow1; IDockableWindow dockWin = getDockWin(dockWinId); DockableWindow1.AddinImpl addiN = AddIn.FromID<DockableWindow1.AddinImpl>(dockWinId); DockableWindow1 myDocWin = addiN.MyDockWin; UserControl uc = (UserControl)myDocWin; System.Windows.Forms.Button myChildControl = (System.Windows.Forms.Button)uc.Controls[0];For a COM based dockable window (using the Dockable Window item template in a standard class library)1) You could expose a separate property or leverage the UserData property of your dockable window:object IDockableWindowDef.UserData { get { return (object)this; } }2) When accessing the dockable window from the separate button:IDockableWindow COMDockWin = getDockWin("{10039c9d-ac61-4dbe-8bec-bba52b6f5fc0}"); UserControl COMuc = (UserControl)COMDockWin.UserData; System.Windows.Forms.Button myCOMChildControl = (System.Windows.Forms.Button)COMuc.Controls[0];Hope this helps!
public DockableWindow1 MyDockWin { get {return m_windowUI;} }
string dockWinId = ThisAddIn.IDs.DockableWindow1; IDockableWindow dockWin = getDockWin(dockWinId); DockableWindow1.AddinImpl addiN = AddIn.FromID<DockableWindow1.AddinImpl>(dockWinId); DockableWindow1 myDocWin = addiN.MyDockWin; UserControl uc = (UserControl)myDocWin; System.Windows.Forms.Button myChildControl = (System.Windows.Forms.Button)uc.Controls[0];
object IDockableWindowDef.UserData { get { return (object)this; } }
IDockableWindow COMDockWin = getDockWin("{10039c9d-ac61-4dbe-8bec-bba52b6f5fc0}"); UserControl COMuc = (UserControl)COMDockWin.UserData; System.Windows.Forms.Button myCOMChildControl = (System.Windows.Forms.Button)COMuc.Controls[0];
Dim dockWindowSW As ESRI.ArcGIS.Framework.IDockableWindow Dim dockWinSWID As UID = New UIDClass() dockWinSWID.Value = My.ThisAddIn.IDs.frmSW dockWindowSW = My.ArcMap.DockableWindowManager.GetDockableWindow(dockWinSWID) dockWindowSW.txtAcres.Text = strArea
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.