Thanks for the responses. I've implemented a solution based on jmhauck's posting. I'm noticing one strange thing though. Initially the toolbar opens up fine and everything is visible. But once I start an edit session, the combobox dissapears. It is still there, you just can't see it. If you click on where the control should be, it then appears and you can select from the drop down list, and use it normally.Why is it dissapearing when I start an edit session??Here is my code for creating the combobox:using System;
using System.Drawing;
using System.Runtime.InteropServices;
using ESRI.ArcGIS.ADF.BaseClasses;
using ESRI.ArcGIS.ADF.CATIDs;
using ESRI.ArcGIS.Controls;
using ESRI.ArcGIS.SystemUI;
namespace DSM_ServiceConnection_Toolbar
{
/// <summary>
/// Summary description for DiametersComboBoxToolCtrl.
/// </summary>
[Guid("135e9481-2245-4411-866b-de687b51c512")]
[ClassInterface(ClassInterfaceType.None)]
[ProgId("DSM_ServiceConnection_Toolbar.DiametersComboBoxToolCtrl")]
public sealed class DiametersComboBoxToolCtrl : BaseCommand, IToolControl
{
#region COM Registration Function(s)
[ComRegisterFunction()]
[ComVisible(false)]
static void RegisterFunction(Type registerType)
{
// Required for ArcGIS Component Category Registrar support
ArcGISCategoryRegistration(registerType);
//
// TODO: Add any COM registration code here
//
}
[ComUnregisterFunction()]
[ComVisible(false)]
static void UnregisterFunction(Type registerType)
{
// Required for ArcGIS Component Category Registrar support
ArcGISCategoryUnregistration(registerType);
//
// TODO: Add any COM unregistration code here
//
}
#region ArcGIS Component Category Registrar generated code
/// <summary>
/// Required method for ArcGIS Component Category registration -
/// Do not modify the contents of this method with the code editor.
/// </summary>
private static void ArcGISCategoryRegistration(Type registerType)
{
string regKey = string.Format("HKEY_CLASSES_ROOT\\CLSID\\{{{0}}}", registerType.GUID);
MxCommands.Register(regKey);
}
/// <summary>
/// Required method for ArcGIS Component Category unregistration -
/// Do not modify the contents of this method with the code editor.
/// </summary>
private static void ArcGISCategoryUnregistration(Type registerType)
{
string regKey = string.Format("HKEY_CLASSES_ROOT\\CLSID\\{{{0}}}", registerType.GUID);
MxCommands.Unregister(regKey);
}
#endregion
#endregion
private IHookHelper m_hookHelper = null;
private DiametersComboBoxCtrl m_diametersComboBoxCtrl = null;
//private IApplication m_application;
public DiametersComboBoxToolCtrl()
{
//
// TODO: Define values for the public properties
//
base.m_category = "DSM Service Connection Tools"; //localizable text
base.m_caption = "Diameters ComboBox"; //localizable text
base.m_message = ""; //localizable text
base.m_toolTip = ""; //localizable text
base.m_name = "Diameters ComboBox"; //unique id, non-localizable (e.g. "MyCategory_ArcMapCommand")
try
{
//
// TODO: change bitmap name if necessary
//
string bitmapResourceName = GetType().Name + ".bmp";
base.m_bitmap = new Bitmap(GetType(), bitmapResourceName);
}
catch (Exception ex)
{
System.Diagnostics.Trace.WriteLine(ex.Message, "Invalid Bitmap");
}
}
#region Overriden Class Methods
/// <summary>
/// Occurs when this command is created
/// </summary>
/// <param name="hook">Instance of the application</param>
public override void OnCreate(object hook)
{
if (hook == null)
return;
if (m_hookHelper == null)
m_hookHelper = new HookHelperClass();
m_hookHelper.Hook = hook;
//make sure that the usercontrol has been initialized
if (null == m_diametersComboBoxCtrl)
{
m_diametersComboBoxCtrl = new DiametersComboBoxCtrl();
m_diametersComboBoxCtrl.CreateControl();
}
}
/// <summary>
/// Occurs when this command is clicked
/// </summary>
public override void OnClick()
{
// TODO: Add DiametersComboBoxToolCtrl.OnClick implementation
}
#endregion
#region IToolControl Members
public bool OnDrop(esriCmdBarType barType)
{
return true;
}
public void OnFocus(ICompletionNotify complete)
{
}
public int hWnd
{
get
{
//pass the handle of the usercontrol
if (null == m_diametersComboBoxCtrl)
{
m_diametersComboBoxCtrl = new DiametersComboBoxCtrl();
m_diametersComboBoxCtrl.CreateControl();
}
return m_diametersComboBoxCtrl.Handle.ToInt32();
}
}
#endregion
}
}