public void GridItemCollection_GetEnumerator_Empty_ReturnsExpected()
        {
            GridItemCollection collection = GridItemCollection.Empty;
            IEnumerator        enumerator = collection.GetEnumerator();

            Assert.False(enumerator.MoveNext());
        }
Ejemplo n.º 2
0
        protected void AutoSizeSplitter(int RightMargin = 32)
        {
            GridItemCollection gridItemCollection = (GridItemCollection)this.oPropertyGridEntries.GetValue(RuntimeHelpers.GetObjectValue(this.oPropertyGridView));

            if (gridItemCollection == null)
            {
                return;
            }
            Graphics    graphics   = Graphics.FromHwnd(this.Handle);
            int         num        = 0;
            IEnumerator enumerator = null;

            try
            {
                enumerator = gridItemCollection.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    GridItem gridItem = (GridItem)enumerator.Current;
                    if (gridItem.GridItemType == GridItemType.Property)
                    {
                        int num2 = checked ((int)Math.Round((double)(unchecked (graphics.MeasureString(gridItem.Label, this.Font).Width + (float)RightMargin))));
                        if (num2 > num)
                        {
                            num = num2;
                        }
                    }
                }
            }
            finally
            {
                if (enumerator is IDisposable)
                {
                    (enumerator as IDisposable).Dispose();
                }
            }
            this.MoveSplitterTo(num);
        }