Beispiel #1
0
        private void OnComponentRemoved(object sender, ComponentEventArgs ce)
        {
            TabItem item = ce.Component as TabItem;

            if (item != null)
            {
                // announce the tab host
                tabHost.Tabs.Remove(item);
                hostGlyph.ComputeBounds();
                adorner.Invalidate();
            }
        }
Beispiel #2
0
        public override bool OnMouseDown(Glyph g, MouseButtons button, Point mouseLoc)
        {
            TabHostGlyph glyph = g as TabHostGlyph;

            if (glyph == null)
            {
                return(base.OnMouseDown(g, button, mouseLoc));
            }

            // add a new tab
            IDesignerHost host = glyph.TabHost.Site.GetService(typeof(IDesignerHost)) as IDesignerHost;
            TabItem       item = host.CreateComponent(typeof(TabItem)) as TabItem;

            // add the item to the tab host
            glyph.TabHost.Tabs.Add(item);

            // refresh the adorner
            glyph.ComputeBounds();
            glyph.Adorner.Invalidate();
            return(true);
        }