コード例 #1
0
ファイル: msng.cs プロジェクト: radtek/PrintersMonitor
        public void Remove(int index)
        {
            RowStyles.RemoveAt(index);
            Controls.RemoveAt(index);
            var c = new Control[Controls.Count];

            Controls.CopyTo(c, 0);
            var C = Controls.Count;

            RowCount = Controls.Count;
            for (int i = index; i < C; i++)
            {
                RowStyles.Add(new RowStyle(SizeType.Absolute, 65F));
                Controls.Add(c[i], 0, i);
            }
        }
コード例 #2
0
        /// <summary>
        /// Sets rows configuration
        /// </summary>
        /// <param name="heights">Row heights in percents</param>
        public void SetRows(float[] heights)
        {
            RowCount = heights.Length;
            while (RowStyles.Count < RowCount)
            {
                RowStyles.Add(new RowStyle(SizeType.Percent, 33.3f));
            }
            while (RowStyles.Count > RowCount)
            {
                RowStyles.RemoveAt(RowStyles.Count - 1);
            }

            for (int i = 0, iMax = heights.Length; i < iMax; i++)
            {
                var rowStyle = RowStyles[i];
                rowStyle.SizeType = SizeType.Percent;
                rowStyle.Height   = heights[i];
            }
        }
コード例 #3
0
ファイル: PluginView.cs プロジェクト: uvbs/test-code-backup
        private bool RemovePluginViewItem(PluginViewItem pvi, bool noRaiseEvent)
        {
            bool flag;

            SuspendLayout();
            try {
                if (!noRaiseEvent)
                {
                    PluginOptionEventArgs e = new PluginOptionEventArgs(pvi);
                    if (PluginRemoved != null)
                    {
                        PluginRemoved(this, e);
                        if (e.Cancel)
                        {
                            return(false);
                        }
                    }
                }
                int index = Controls.IndexOf(pvi);
                if (iSelectedIndex == index)
                {
                    iSelectedIndex = -1;
                }
                if (index > -1)
                {
                    Controls.RemoveAt(index);
                    RowStyles.RemoveAt(index);
                    RowCount--;
                    for (int i = 0; i < Controls.Count; i++)
                    {
                        SetRow(Controls[i], i);
                    }
                    pvi.Dispose();
                    return(true);
                }
                flag = false;
            }
            finally {
                ResumeLayout();
            }
            return(flag);
        }