user1952408
user1952408

Reputation: 1

My user controls don't appear in tool box

i have program with some user controls but when i build solutions the user controls don't appear on tool box, for test i made another user control and after re build it appeared on tool box ! this is one of my user controls:

 using System.Drawing;
using System.Windows.Forms;

namespace AMIgo
{
  /// <summary>A UserControl used to display and interact with the active calls.</summary>
  /// <remarks>This display reflect the content of the <see cref="AMI_Client.AstCallsList"/> which contains the current active calls.
  /// The ListViewCalls display allows to show the items in differents layouts, in a similar way than the windows file explorer.
  /// <para>A menu allows to select to display Inbound( show in Red (default), Outbound (shown in blue) and internal (shown in gray) calls.</para>
  /// <para>Properties allows to set the font and colors of the ListView and ListItems</para>
  /// <para>Drag / Drop: You can drag an active call and drop it onto an extension in the <see cref="ListViewLines"/> display to Transfer a 
  /// caller to an extension. You can drag and drop an active call to the display toolbar drop target to Transfer the active channel to the 
  /// selected destination, to park the call or to hang it up. You can also drag an active channel to the <see cref="AMIgoDropTarget"/> form to Transfer a call to the selected destination. 
  /// (Extension, queue, conference, etc)</para>
  /// <para> Context Menu: Right click on an item to open a Context menu.</para>
  /// <seealso cref="AstCall"/><seealso cref="AMI_Client.NewCallEvent"/></remarks>
  [ToolboxBitmap(typeof(AMIgo.ListViewCalls), "Resources.Control_ListView.bmp")]
  public partial class ListViewCalls : AMIgoControl
  {
    /// <summary>Gets or sets a value indicating whether the intermediary agents channels are displayed.</summary>
    /// <value><c>true</c> to show Agents channels otherwise, <c>false</c>.</value>
    public bool ShowAgentsChannels { get; set; }
    private bool _show_outbound_calls;
    /// <summary>Gets or sets a value indicating whether the outbound calls are displayed.</summary>
    /// <value><c>true</c> to show outbound calls, otherwise, <c>false</c>.</value>
    public bool ShowOutboundCalls 
    {
      get { return (_show_outbound_calls); } 
      set 
      {
        _show_outbound_calls = value;
        outboundToolStripMenuItem.Checked = _show_outbound_calls;
      }
    }
    private bool _show_internal_calls;
.
.
.
.
.

and this is AMIgoControl file...

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Forms;

namespace AMIgo
{
  /// <summary>
  /// This is the base control from which inherit most of the AMIgo controls
  /// </summary>
  [DesignTimeVisible(false)]
  [System.ComponentModel.ToolboxItem(false)]
  public class AMIgoControl : UserControl
  {
    /// <summary>true after this control has been initialized. </summary>
    public bool _InitDone;
    /// <summary>Gets or sets the AMI_Client instance. The AMI_Client component will set this on startup if left blank.</summary>
    public virtual AMIgo.AMI_Client AMI_ClientInstance { get; set; }
    /// <summary>Initializes a new instance of the <see cref="AMIgoControl"/> class.</summary>
    public AMIgoControl() { }
    /// <summary>Initializes a new instance of the <see cref="AMIgoControl"/> class. </summary>
    /// <param name="AMI_ClientInstance">The AMI_Client instance.</param>
    public AMIgoControl(AMIgo.AMI_Client AMI_ClientInstance)
    {
      this.AMI_ClientInstance = AMI_ClientInstance;
    }
    /// <summary>Finds a Control recursively. Note finds the first match and exits</summary>
    /// <param name="Container">The container to search for the given control type.
    /// Remember all controls (Panel, GroupBox, Form, etc are all containers for controls
    /// </param>
    /// <param name="TypeName">Name of the type of control to look for</param>
    /// <returns>The control object if found or null</returns>
    /// 
    public Control FindControlRecursive(Control Container, string TypeName)
    {
      if (Container.GetType().Name == TypeName)
        return Container;

      foreach (Control ctrl in Container.Controls)
      {
        Control foundCtrl = FindControlRecursive(ctrl, TypeName);
        if (foundCtrl != null)
          return foundCtrl;
      }
      return null;
    }

  } //UserControl

Upvotes: 0

Views: 763

Answers (1)

Bobby
Bobby

Reputation: 251

Just for the starters: Toolbox in VS applies context filters so, you won't see the user controls unless you have a designer opened and active in the document well. If you have tried this and still don't see the controls - would you be able to post a screenshot for better understanding? Also, mention the version of VS you are using - I just tried creating a sample UC on VS12 and it works just as expected. Perhaps, you might want to do that test too and post the update with result.

update: by the way, you might want to remove that ToolboxItem(false) attribute on AMIgo class.

Upvotes: 3

Related Questions