Example #1
0
        public bool LoadXml(string filename)
        {
            try
            {
                XmlSerializer serializer = new XmlSerializer(typeof(CustomPropertyCollection));
                FileStream    reader     = new FileStream(filename, FileMode.Open);

                CustomPropertyCollection cpc = (CustomPropertyCollection)serializer.Deserialize(reader);
                foreach (CustomProperty customprop in cpc)
                {
                    customprop.RebuildAttributes();
                    this.Add(customprop);
                }
                cpc = null;
                reader.Close();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
        public PropertyGridEx()
        {
            // This call is required by the Windows Form Designer.
            InitializeComponent();

            // Add any initialization after the InitializeComponent() call.
            SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            SetStyle(ControlStyles.SupportsTransparentBackColor, true);

            // Initialize collections
            oCustomPropertyCollection = new CustomPropertyCollection();
            oCustomPropertyCollectionSet = new CustomPropertyCollectionSet();

            // Attach internal controls
            oPropertyGridView = base.GetType().BaseType.InvokeMember("gridView", BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.Instance, null, this, null);
            oHotCommands = base.GetType().BaseType.InvokeMember("hotcommands", BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.Instance, null, this, null);
            oToolStrip = (ToolStrip) base.GetType().BaseType.InvokeMember("toolStrip", BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.Instance, null, this, null);
            oDocComment = base.GetType().BaseType.InvokeMember("doccomment", BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.Instance, null, this, null);

            // Attach DocComment internal fields
            if (oDocComment != null)
            {
                oDocCommentTitle = (Label)oDocComment.GetType().InvokeMember("m_labelTitle", BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.Instance, null, oDocComment, null);
                oDocCommentDescription = (Label)oDocComment.GetType().InvokeMember("m_labelDesc", BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.Instance, null, oDocComment, null);
            }

            // Attach PropertyGridView internal fields
            if (oPropertyGridView != null)
            {
                oPropertyGridEntries = oPropertyGridView.GetType().GetField("allGridEntries", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly);
            }

            // Apply Toolstrip style
            if (oToolStrip != null)
            {
                ApplyToolStripRenderMode(bDrawFlatToolbar);
            }
        }
Example #3
0
        public PropertyGridEx()
        {
            // This call is required by the Windows Form Designer.
            InitializeComponent();

            // Add any initialization after the InitializeComponent() call.
            SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            SetStyle(ControlStyles.SupportsTransparentBackColor, true);

            // Initialize collections
            oCustomPropertyCollection    = new CustomPropertyCollection();
            oCustomPropertyCollectionSet = new CustomPropertyCollectionSet();

            // Attach internal controls
            oPropertyGridView = base.GetType().BaseType.InvokeMember("gridView", BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.Instance, null, this, null);
            oHotCommands      = base.GetType().BaseType.InvokeMember("hotcommands", BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.Instance, null, this, null);
            oToolStrip        = (ToolStrip)base.GetType().BaseType.InvokeMember("toolStrip", BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.Instance, null, this, null);
            oDocComment       = base.GetType().BaseType.InvokeMember("doccomment", BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.Instance, null, this, null);

            // Attach DocComment internal fields
            if (oDocComment != null)
            {
                oDocCommentTitle       = (Label)oDocComment.GetType().InvokeMember("m_labelTitle", BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.Instance, null, oDocComment, null);
                oDocCommentDescription = (Label)oDocComment.GetType().InvokeMember("m_labelDesc", BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.Instance, null, oDocComment, null);
            }

            // Attach PropertyGridView internal fields
            if (oPropertyGridView != null)
            {
                oPropertyGridEntries = oPropertyGridView.GetType().GetField("allGridEntries", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly);
            }

            // Apply Toolstrip style
            if (oToolStrip != null)
            {
                ApplyToolStripRenderMode(bDrawFlatToolbar);
            }
        }
 public virtual int Add(CustomPropertyCollection value)
 {
     return base.List.Add(value);
 }
 public virtual int Add(CustomPropertyCollection value)
 {
     return(base.List.Add(value));
 }
        private void FillGridsPropertyGroups()
        {
            try
            {
                this.SuspendLayout();
                this._gridWnd.ShowCustomProperties = true;
                this._gridWnd.ItemSet.Clear();

                CustomPropertysManager manager = CustomPropertysManager.Instance;
                ICustomPropertyMaker maker = null;
                CustomPropertyCollection collection = null;
                CustomProperty property = null;

                foreach (PropertyGroup group in _propertyGroups)
                {
                    collection = new CustomPropertyCollection();

                    foreach (PropertyItem item in group)
                    {
                        property = manager.Make(item);
                        if (null != property)
                        {
                            collection.Add(property);
                        }
                    }

                    this._gridWnd.ItemSet.Add(collection);

                    collection = null;
                }

                this._gridWnd.ResumeLayout(false);
                this._gridWnd.PerformLayout();
                this.ResumeLayout(false);
                this.PerformLayout();
                this._gridWnd.Refresh();
                this.Refresh();
            }
            catch (Exception ex)
            {
                Toolkit.DEBUG_TRACE("Monkey.Processing.UI.GeneralPropertyGridControl.FillGridsPropertyGroups Exception:" + ex.Message + "\n");
                return;
            }
        }