Exemplo n.º 1
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 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);
            }
        }
Exemplo n.º 3
0
        public bool LoadXml(string filename)
        {
            bool        result;
            IEnumerator enumerator = null;

            try
            {
                XmlSerializer            xmlSerializer            = new XmlSerializer(typeof(CustomPropertyCollection));
                FileStream               fileStream               = new FileStream(filename, FileMode.Open);
                CustomPropertyCollection customPropertyCollection = (CustomPropertyCollection)xmlSerializer.Deserialize(fileStream);
                try
                {
                    enumerator = customPropertyCollection.GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        CustomProperty customProperty = (CustomProperty)enumerator.Current;
                        customProperty.RebuildAttributes();
                        this.Add(customProperty);
                    }
                }
                finally
                {
                    if (enumerator is IDisposable)
                    {
                        (enumerator as IDisposable).Dispose();
                    }
                }
                fileStream.Close();
                result = true;
            }
            catch (Exception expr_7A)
            {
                ProjectData.SetProjectError(expr_7A);
                result = false;
                ProjectData.ClearProjectError();
            }
            return(result);
        }
Exemplo n.º 4
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);
            }
        }
Exemplo n.º 5
0
 public PropertyGridEx()
 {
     this.InitializeComponent();
     this.DoubleBuffered               = true;
     this.oCustomPropertyCollection    = new CustomPropertyCollection();
     this.oCustomPropertyCollectionSet = new CustomPropertyCollectionSet();
     this.oPropertyGridView            = RuntimeHelpers.GetObjectValue(base.GetType().BaseType.InvokeMember("gridView", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetField, null, this, null));
     this.oHotCommands = RuntimeHelpers.GetObjectValue(base.GetType().BaseType.InvokeMember("hotcommands", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetField, null, this, null));
     this.oToolStrip   = (ToolStrip)base.GetType().BaseType.InvokeMember("toolStrip", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetField, null, this, null);
     this.oDocComment  = RuntimeHelpers.GetObjectValue(base.GetType().BaseType.InvokeMember("doccomment", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetField, null, this, null));
     if (this.oDocComment != null)
     {
         this.oDocCommentTitle       = (Label)this.oDocComment.GetType().InvokeMember("m_labelTitle", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetField, null, RuntimeHelpers.GetObjectValue(this.oDocComment), null);
         this.oDocCommentDescription = (Label)this.oDocComment.GetType().InvokeMember("m_labelDesc", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetField, null, RuntimeHelpers.GetObjectValue(this.oDocComment), null);
     }
     if (this.oPropertyGridView != null)
     {
         this.oPropertyGridEntries = this.oPropertyGridView.GetType().GetField("allGridEntries", BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.NonPublic);
     }
     if (this.oToolStrip != null)
     {
         this.ApplyToolStripRenderMode(this.bDrawFlatToolbar);
     }
 }
Exemplo n.º 6
0
 public virtual int Add(CustomPropertyCollection value)
 {
     return(base.List.Add(value));
 }
		public virtual int Add(CustomPropertyCollection value)
		{
			return base.List.Add(value);
		}