Exemple #1
0
        public ToolboxService2(IDesignerHost host)
        {
            this.host = host;

            // Our MainForm adds our ToolboxPane to the host's services.
            toolbox = host.GetService(typeof(ToolboxPane2)) as ToolboxPane2;
        }
        //
        public ToolboxTab2(ToolboxPane2 owner, string name, int idx, bool readOnly)
        {
            this.AutoScroll = false;
            this.AutoSize   = false;
            this.HScroll    = false;
            this.VScroll    = false;

            _readOnly                    = readOnly;
            index                        = idx;
            toolbox                      = owner;
            itemList                     = new clsToolList();
            itemList.AllowDrop           = true;
            itemList.ScrollAlwaysVisible = false;
            itemList.SelectionMode       = SelectionMode.One;
            itemList.HorizontalScrollbar = false;
            itemList.IntegralHeight      = false;
            itemList.BackColor           = System.Drawing.Color.LightSlateGray;
            itemList.DrawMode            = System.Windows.Forms.DrawMode.OwnerDrawFixed;

            itemList.Name                  = "tools_" + name;
            itemList.Size                  = new System.Drawing.Size(this.ClientSize.Width, 200);
            itemList.TabIndex              = 0;
            itemList.KeyDown              += new System.Windows.Forms.KeyEventHandler(this.list_KeyDown);
            itemList.MouseDown            += new System.Windows.Forms.MouseEventHandler(this.list_MouseDown);
            itemList.MeasureItem          += new System.Windows.Forms.MeasureItemEventHandler(this.list_MeasureItem);
            itemList.SelectedIndexChanged += new EventHandler(itemList_SelectedIndexChanged);
            itemList.MouseMove            += new MouseEventHandler(itemList_MouseMove);
            itemList.Items.Add(new xToolboxItem((Type)null));
            itemList.SelectedIndex = 0;
            //
            if (_readOnly)
            {
                lblTitle = new LabelToolboxTabTitle(this);
            }
            else
            {
                lblTitle = new LabelToolboxTabTitleCust(this);
            }
            lblTitle.Name     = "title_" + name;
            lblTitle.Text     = name;
            lblTitle.Width    = this.ClientSize.Width;
            lblTitle.Location = new System.Drawing.Point(0, 0);
            itemList.Location = new System.Drawing.Point(0, lblTitle.Height);
            itemList.Visible  = true;
            lblTitle.Visible  = true;
            //
            Controls.Add(lblTitle);
            Controls.Add(itemList);
            //
            this.Name = name;
        }
 public ToolboxTabProject(ToolboxPane2 owner, string name, Guid projectGuid)
     : base(owner, string.Format(CultureInfo.InvariantCulture, "p{0}", projectGuid.GetHashCode().ToString("x", CultureInfo.InvariantCulture)), 0, true)
 {
     _prjGuid = projectGuid;
     SetTitle(name);
 }