public bool FilterProperties(IComponent component, IDictionary properties)
        {
            IDesignerFilter filter = this.GetDesignerFilter(component);

            if (filter != null)
            {
                filter.PreFilterProperties(properties);
                filter.PostFilterProperties(properties);
                return(true);
            }
            return(false);
        }
Exemple #2
0
        /// Tell the given component's designer to filter events.
        public bool FilterEvents(System.ComponentModel.IComponent component, System.Collections.IDictionary events)
        {
            IDesignerFilter filter = GetDesignerFilter(component);

            if (filter != null)
            {
                filter.PreFilterEvents(events);
                filter.PostFilterEvents(events);
                return(true);
            }
            return(false);
        }
Exemple #3
0
        /// Tell the given component's designer to filter properties.
        public bool FilterProperties(System.ComponentModel.IComponent component, System.Collections.IDictionary properties)
        {
            IDesignerFilter filter = GetDesignerFilter(component);

            if (filter != null)
            {
                filter.PreFilterProperties(properties);
                filter.PostFilterProperties(properties);
                PropertyDescriptor pd = properties["Name"] as PropertyDescriptor;
                if (pd != null)
                {
                    properties["Name"] = new SYNamePropertyDescriptor(pd);
                }
                return(true);
            }
            return(false);
        }
        /// <summary>
        /// Initializes the designer with the specified component.
        /// </summary>
        /// <param name="component">The <see cref="T:System.ComponentModel.IComponent"/> to associate the designer with. This component must always be an instance of, or derive from, <see cref="T:System.Windows.Forms.Control"/>. </param>
        public override void Initialize(IComponent component)
        {
            // Debug.WriteLine("ObjectListViewDesigner.Initialize");

            // Use reflection to bypass the "internal" marker on ListViewDesigner
            // If we can't get the unversioned designer, look specifically for .NET 4.0 version of it.
            Type tListViewDesigner = Type.GetType("System.Windows.Forms.Design.ListViewDesigner, System.Design") ??
                                     Type.GetType("System.Windows.Forms.Design.ListViewDesigner, System.Design, " +
                                                  "Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
            if (tListViewDesigner == null) throw new ArgumentException("Could not load ListViewDesigner");

            this.listViewDesigner = (ControlDesigner)Activator.CreateInstance(tListViewDesigner, BindingFlags.Instance | BindingFlags.Public, null, null, null);
            this.designerFilter = this.listViewDesigner;

            // Fetch the methods from the ListViewDesigner that we know we want to use
            this.listViewDesignGetHitTest = tListViewDesigner.GetMethod("GetHitTest", BindingFlags.Instance | BindingFlags.NonPublic);
            this.listViewDesignWndProc = tListViewDesigner.GetMethod("WndProc", BindingFlags.Instance | BindingFlags.NonPublic);

            Debug.Assert(this.listViewDesignGetHitTest != null, "Required method (GetHitTest) not found on ListViewDesigner");
            Debug.Assert(this.listViewDesignWndProc != null, "Required method (WndProc) not found on ListViewDesigner");

            // Tell the Designer to use properties of default designer as well as the properties of this class (do before base.Initialize)
            TypeDescriptor.CreateAssociation(component, this.listViewDesigner);

            IServiceContainer site = (IServiceContainer)component.Site;
            if (site != null && GetService(typeof(DesignerCommandSet)) == null) {
                site.AddService(typeof(DesignerCommandSet), new CDDesignerCommandSet(this));
            } else {
                Debug.Fail("site != null && GetService(typeof (DesignerCommandSet)) == null");
            }

            this.listViewDesigner.Initialize(component);
            base.Initialize(component);

            RemoveDuplicateDockingActionList();
        }