Exemplo n.º 1
0
        /// <summary>
        /// Clear List Control(ListView, ComboBox, TreeView, FpSpread)
        /// </summary>
        /// <param name="ListControl"></param>
        /// <param name="SpaceFlag"></param>
        public static void ClearList(System.Windows.Forms.Control ListControl, Boolean SpaceFlag)
        {
            if (ListControl is ListView)
            {
                ((ListView)ListControl).Items.Clear();
            }
            else if (ListControl is ComboBox)
            {
                ((ComboBox)ListControl).Items.Clear();
                if (SpaceFlag == true)
                {
                    ((ListView)ListControl).Items.Add("");
                }
            }
            else if (ListControl is TreeView)
            {
                ((TreeView)ListControl).Nodes.Clear();
            }
            else if (ListControl is FarPoint.Win.Spread.FpSpread)
            {
                FarPoint.Win.Spread.SheetView spdView = null;

                spdView = ((FarPoint.Win.Spread.FpSpread)ListControl).Sheets[0];
                spdView.ClearRange(0, 0, spdView.RowCount, spdView.ColumnCount, true);
                spdView.RowCount = 0;
            }
        }