Exemplo n.º 1
0
            public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
            {
                if (destinationType == null)
                {
                    throw new ArgumentNullException(nameof(destinationType));
                }

                if (destinationType == typeof(InstanceDescriptor) && value is TableLayoutStyle)
                {
                    TableLayoutStyle style = (TableLayoutStyle)value;

                    switch (style.SizeType)
                    {
                    case SizeType.AutoSize:
                        return(new InstanceDescriptor(
                                   style.GetType().GetConstructor(new Type[] {}),
                                   new object[] {}));

                    case SizeType.Absolute:
                    case SizeType.Percent:
                        return(new InstanceDescriptor(
                                   style.GetType().GetConstructor(new Type[] { typeof(SizeType), typeof(int) }),
                                   new object[] { style.SizeType, style.Size }));

                    default:
                        break;
                    }
                }
                return(base.ConvertTo(context, culture, value, destinationType));
            }
Exemplo n.º 2
0
 private void EnsureNotOwned(TableLayoutStyle style)
 {
     if (style.Owner != null)
     {
         throw new ArgumentException(System.Windows.Forms.SR.GetString("OnlyOneControl", new object[] { style.GetType().Name }), "style");
     }
 }
 private void EnsureNotOwned(TableLayoutStyle style)
 {
     if (style.Owner != null)
     {
         throw new ArgumentException(System.Windows.Forms.SR.GetString("OnlyOneControl", new object[] { style.GetType().Name }), "style");
     }
 }
 private void EnsureNotOwned(TableLayoutStyle style)
 {
     if (style.Owner != null)
     {
         throw new ArgumentException(string.Format(SR.OnlyOneControl, style.GetType().Name), "style");
     }
 }
Exemplo n.º 5
0
        public void RemoveAt(int index)
        {
            TableLayoutStyle style = (TableLayoutStyle)this._innerList[index];

            style.Owner = null;
            this._innerList.RemoveAt(index);
            this.PerformLayoutIfOwned();
        }
 /// <include file='doc\TableLayoutSettings.uex' path='docs/doc[@for="StyleCollection.IList.this"]/*' />
 /// <internalonly/>
 object IList.this[int index] {
     get { return(_innerList[index]); }
     set {
         TableLayoutStyle style = (TableLayoutStyle)value;
         EnsureNotOwned(style);
         style.Owner       = this.Owner;
         _innerList[index] = style;
         PerformLayoutIfOwned();
     }
 }
 internal TableLayoutPanelResizeGlyph(Rectangle controlBounds, TableLayoutStyle style, Cursor hitTestCursor, System.Windows.Forms.Design.Behavior.Behavior behavior)
     : base(behavior)
 {
     this.bounds = controlBounds;
     this.hitTestCursor = hitTestCursor;
     this.style = style;
     if (style is ColumnStyle)
     {
         this.type = TableLayoutResizeType.Column;
     }
     else
     {
         this.type = TableLayoutResizeType.Row;
     }
 }
Exemplo n.º 8
0
        //
        // The IList methods will later be implemeneted, this is to get us started
        //
        int IList.Add(object style)
        {
            TableLayoutStyle layoutStyle = (TableLayoutStyle)style;

            if (layoutStyle.Owner != null)
            {
                throw new ArgumentException("Style is already owned");
            }

            layoutStyle.Owner = table;
            int result = al.Add(layoutStyle);

            if (table != null)
            {
                table.PerformLayout();
            }

            return(result);
        }
Exemplo n.º 9
0
 public int Add(TableLayoutStyle style)
 {
     return(((IList)this).Add(style));
 }
Exemplo n.º 10
0
 /// <include file='doc\TableLayoutSettings.uex' path='docs/doc[@for="StyleCollection.Add2"]/*' />
 /// <internalonly/>
 public int Add(TableLayoutStyle style) {
     return ((IList)this).Add(style);
 }
Exemplo n.º 11
0
 private void EnsureNotOwned(TableLayoutStyle style) {
     if(style.Owner != null) {
         throw new ArgumentException(SR.GetString(SR.OnlyOneControl, style.GetType().Name), "style");
     }
 }
Exemplo n.º 12
0
 public int Add(TableLayoutStyle style)
 {
     throw null;
 }