예제 #1
0
        public int ChangeColumnStartX(int column_index, int dx)
        {
            IEnumerator enumerator = this.ColumnDatas.GetEnumerator();
            float       num        = (float)base.Width;

            if (enumerator.MoveNext())
            {
                do
                {
                    ColumnData columnData = enumerator.Current as ColumnData;
                    num -= columnData.MinWidth;
                }while (enumerator.MoveNext());
            }
            if (num <= 0f)
            {
                return(0);
            }
            ColumnData columnData2 = this.ColumnDatas[column_index] as ColumnData;
            float      num2        = (float)base.Width - columnData2.StartX;
            float      num3        = 0f;
            float      num4        = 0f;

            enumerator = this.ColumnDatas.GetRange(column_index, this.ColumnDatas.Count - column_index).GetEnumerator();
            if (enumerator.MoveNext())
            {
                do
                {
                    ColumnData columnData3 = enumerator.Current as ColumnData;
                    num3 = columnData3.MinWidth + num3;
                    num4 = columnData3.Proportion + num4;
                }while (enumerator.MoveNext());
                if (num4 != 0f)
                {
                    goto IL_DE;
                }
            }
            num4 = 1f;
IL_DE:
            num2 -= num3;
            float num5 = (float)dx;
            float num6 = num2 - num5;

            if (num6 < 0f)
            {
                dx = (int)((double)num2);
                if (column_index > 0)
                {
                    ColumnData columnData4 = this.ColumnDatas[column_index - 1] as ColumnData;
                    float      num7        = columnData4.Width + (float)dx;
                    if (num7 >= columnData4.MinWidth)
                    {
                        columnData4.Width      = num7;
                        columnData4.Proportion = (num7 - columnData4.MinWidth) / num;
                    }
                    else
                    {
                        if (columnData4.Width <= columnData4.MinWidth)
                        {
                            return(0);
                        }
                        dx = (int)((double)(columnData4.MinWidth - columnData4.Width));
                        float minWidth = columnData4.MinWidth;
                        columnData4.Width      = minWidth;
                        columnData4.Proportion = (minWidth - columnData4.MinWidth) / num;
                    }
                }
                float num8 = columnData2.StartX + (float)dx;
                enumerator = this.ColumnDatas.GetRange(column_index, this.ColumnDatas.Count - column_index).GetEnumerator();
                if (enumerator.MoveNext())
                {
                    do
                    {
                        ColumnData columnData5 = enumerator.Current as ColumnData;
                        columnData5.StartX = num8;
                        float minWidth2 = columnData5.MinWidth;
                        columnData5.Width = minWidth2;
                        num8 = minWidth2 + num8;
                    }while (enumerator.MoveNext());
                }
                return(dx);
            }
            num2 = num6;
            if (num2 > 0f)
            {
                if (column_index > 0)
                {
                    ColumnData columnData6 = this.ColumnDatas[column_index - 1] as ColumnData;
                    float      num9        = columnData6.Width + num5;
                    if (num9 >= columnData6.MinWidth)
                    {
                        columnData6.Width      = num9;
                        columnData6.Proportion = (num9 - columnData6.MinWidth) / num;
                    }
                    else
                    {
                        if (columnData6.Width <= columnData6.MinWidth)
                        {
                            return(0);
                        }
                        num2  = num5 + num2;
                        dx    = (int)((double)(columnData6.MinWidth - columnData6.Width));
                        num5  = (float)dx;
                        num2 -= num5;
                        float minWidth3 = columnData6.MinWidth;
                        columnData6.Width      = minWidth3;
                        columnData6.Proportion = (minWidth3 - columnData6.MinWidth) / num;
                    }
                }
                float num10 = columnData2.StartX + num5;
                enumerator = this.ColumnDatas.GetRange(column_index, this.ColumnDatas.Count - column_index).GetEnumerator();
                if (enumerator.MoveNext())
                {
                    float num11 = 1f / num4;
                    float num12 = 1f / num;
                    do
                    {
                        ColumnData columnData7 = enumerator.Current as ColumnData;
                        columnData7.StartX = num10;
                        float num13 = columnData7.Proportion * num11 * num2 + columnData7.MinWidth;
                        columnData7.Width      = num13;
                        columnData7.Proportion = (num13 - columnData7.MinWidth) * num12;
                        num10 = columnData7.Width + num10;
                    }while (enumerator.MoveNext());
                }
                return(dx);
            }
            return(0);
        }
예제 #2
0
        public unsafe PropertyTree(int descriptionlines, NewAssetPicker.ObjectType objecttype, NPropertyClipboard *clipboard)
        {
            this.ItemChanged          = null;
            this.SelectedIndexChanged = null;
            this.TrackSelected        = null;
            Color backColor = Color.FromKnownColor(KnownColor.Window);

            this.BackColor           = backColor;
            this.PropTreeDescription = new Label();
            Color backColor2 = Color.FromKnownColor(KnownColor.Control);

            this.PropTreeDescription.BackColor = backColor2;
            Color foreColor = Color.FromKnownColor(KnownColor.ControlText);

            this.PropTreeDescription.ForeColor   = foreColor;
            this.PropTreeDescription.BorderStyle = BorderStyle.Fixed3D;
            this.PropTreeDescription.Width       = base.Width;
            this.PropTreeDescription.Height      = (this.Font.Height + 2) * descriptionlines;
            this.PropTreeDescription.Dock        = DockStyle.Bottom;
            this.PropTreeCore = new PropertyTreeCore(base.Width, base.Height, base.Height, 2, this.PropTreeDescription, objecttype, clipboard);
            Point location = new Point(0, 20);

            this.PropTreeCore.Location = location;
            ArrayList arrayList = new ArrayList();

            arrayList.Add(new ColumnItem(new string((sbyte *)(& < Module >.?? _C@_07CKMABNOK@Setting?$AA@)), 90));
            arrayList.Add(new ColumnItem(new string((sbyte *)(& < Module >.?? _C@_05LPIJGKJ@Value?$AA@)), 70));
            IEnumerator enumerator = arrayList.GetEnumerator();
            float       proportion = 1f / (float)arrayList.Count;

            if (enumerator.MoveNext())
            {
                do
                {
                    ColumnItem columnItem = enumerator.Current as ColumnItem;
                    ColumnData columnData = new ColumnData(columnItem.Name, (int)((double)columnItem.MinWidth));
                    columnData.Proportion = proportion;
                    this.ColumnDatas.Add(columnData);
                }while (enumerator.MoveNext());
            }
            this.PropTreeHeader        = new HeaderControl(this.PropTreeCore);
            this.PropTreeHeader.Width  = this.PropTreeCore.GetViewControlWidth();
            this.PropTreeHeader.Height = 20;
            this.PropTreeCorner        = new Control();
            Point location2 = new Point(this.PropTreeHeader.Width, 0);

            this.PropTreeCorner.Location = location2;
            this.PropTreeCorner.Width    = base.Width - this.PropTreeHeader.Width;
            this.PropTreeCorner.Height   = 20;
            Color backColor3 = Color.FromKnownColor(KnownColor.Control);

            this.PropTreeCorner.BackColor = backColor3;
            int num = base.Height - this.PropTreeHeader.Height;

            this.PropTreeCore.Height = num - this.PropTreeDescription.Height;
            this.PropTreeHeader.RecalcColumnDatas();
            this.PropTreeHeader.Refresh();
            this.PropTreeCore.Refresh();
            this.OwnControls.Add(this.PropTreeHeader);
            this.OwnControls.Add(this.PropTreeCorner);
            this.OwnControls.Add(this.PropTreeCore);
            this.OwnControls.Add(this.PropTreeDescription);
            this.PropTreeCore.ItemChanged          += new PropertyTreeCore.__Delegate_ItemChanged(this.PropTreeCore_ItemChanged);
            this.PropTreeCore.SelectedIndexChanged += new PropertyTreeCore.__Delegate_SelectedIndexChanged(this.PropTreeCore_SelectedIndexChanged);
            this.PropTreeCore.TrackSelected        += new PropertyTreeCore.TrackSelectedHandler(this.PropTreeCore_TrackSelected);
        }