to ArcGIS of the Toolbarcontrol Add any of the Windows How to build [ go ]
Link: Span style= "color: #666666; Font-family:verdana "> http://www.cnblogs.com/mymhj/archive/2012/10/12/2721036.html
Summary: In use Arcengine in development, give Toolbarcontrol Add a command item in the form of a button I'm sure we're all familiar with this, because there are many examples online. However, this method of using the Click Invoke feature can only meet the needs of most users in terms of experience, in addition to the user is likely to require you to add similar text boxes in the toolbar , Radio box, selection panel , ComboBox wait Windows control, today a colleague asked me this question to do an example here. For everyone's reference.
Specific implementation:
? 1 Knowledge-servicing
? (1) in fact, to achieve this effect is very simple, as long as you understand Arcgis in the Itoolcontrol the use of interfaces is not difficult to achieve.
?? Itoolcontrol This interface has only a simple three methods:
??
hwnd : is a read-only property that returns the control to the caller handle .
OnDrop : Is a method that is used by the caller to verify whether the current control can be dragged.
onfocus: is a method that is used to invoke notification of the current item that you have focused on.
(2) In addition to understanding Itoolcotrol interface, you must also have the ability to know how to create Arcgis command plug-in knowledge, and how to invoke the plug-in method.
??
2 Implement
?? with a simple Combobox For example:
??? public sealed Class Command1:basecommand, Itoolcontrol
??? {
?
??????? privat e int _handle = 0;
??????? Private icompletionnotify _compnotify;
??????? Private System.Windows.Forms.ComboBox ComboBox = new System.Windows.Forms.ComboBox ();
??????? Private Ihookhelper m_hookhelper = null;
??????? Public Command1 ()
??????? {
??????????? This._handle = ComboBox.Handle.ToInt32 ();
??????????? ComboBox.Items.Add (" everyone is really good. 1 ");
??????????? ComboBox.Items.Add (" everyone is really good. 1 ");
??????????? ComboBox.Items.Add (" everyone is really good. 1 ");
???????}
??????? #region Overriden Class Methods
??????? <summary>
??????? Occurs when the This command is created
??????? </summary>
??????? <param name= "Hook" >instance of the Application</param>
??????? public override void OnCreate (object hook)
??????? {
??????????? if (hook = = null)
??????????????? Return
??????????? Try
??????????? {
??????????????? M_hookhelper = new Hookhelperclass ();
??????????????? M_hookhelper.hook = Hook;
??????????????? if (M_hookhelper.activeview = = null)
??????????????????? M_hookhelper = null;
??????????? }
??????????? Catch
??????????? {
??????????????? M_hookhelper = null;
??????????? }
??????????? if (M_hookhelper = = null)
??????????????? base.m_enabled = false;
??????????? Else
??????????????? Base.m_enabled = true;
??????????? Todo:? ADD Other initialization code
??????? }
??????? <summary>
??????? Occurs when the this command is clicked
??????? </summary>
??????? public override void OnClick ()
??????? {
??????????? Todo:add Command1.onclick Implementation
??????? }
??????? #endregion
??????? #region Itoolcontrol member
??????? public bool OnDrop (Esricmdbartype bartype)
??????? {
??????????? if (Bartype = = Esricmdbartype.esricmdbartypetoolbar)
??????????? {
??????????????? return true;
??????????? }
??????????? else return false;
??????? }
??????? public void onfocus (icompletionnotify complete)
??????? {
??????????? _compnotify = complete;
??????? }
??????? public int HWnd
??????? {
??????????? Get
??????????? {
??????????????? return _handle;
??????????? }
??????? }
??????? #endregion
??? }
3 Achieve Results
?
According to this example can be added, the other Windows Control
??
4? Instance Code