예제 #1
0
        private void frmSampleGridContextMenu_Load(object sender, System.EventArgs e)
        {
            grid1.Redim(2, 2);
            grid1.AutoStretchColumnsToFitWidth = true;

            Cells.Cell l_Cell1 = new Cells.Cell("ContextMenuStyle:");
            grid1[0, 0]       = l_Cell1;
            l_Cell1.BackColor = Color.LightGray;

            Cells.Cell l_Cell2 = new Cells.Cell(grid1.ContextMenuStyle, typeof(SourceGrid2.ContextMenuStyle));
            grid1[0, 1] = l_Cell2;
            l_Cell2.Behaviors.Add(new SourceGrid2.BehaviorModels.BindProperty(typeof(SourceGrid2.Grid).GetProperty("ContextMenuStyle"), grid1));

            Cells.Cell l_Cell3 = new Cells.Cell("Cell ContextMenu:");
            grid1[1, 0]       = l_Cell3;
            l_Cell3.BackColor = Color.LightGray;
            Cells.Cell l_Cell4 = new Cells.Cell("Right-Click on Me");
            grid1[1, 1] = l_Cell4;
            l_Cell4.ContextMenuItems.Add(new System.Windows.Forms.MenuItem("Cell[1,1] Context Menu 1"));
            l_Cell4.ContextMenuItems.Add(new System.Windows.Forms.MenuItem("Cell[1,1] Context Menu 2"));

            grid1.Selection.ContextMenuItems = new SourceGrid2.MenuCollection();
            grid1.Selection.ContextMenuItems.Add(new System.Windows.Forms.MenuItem("Selection Context Menu 1"));
            grid1.Selection.ContextMenuItems.Add(new System.Windows.Forms.MenuItem("Selection Context Menu 2"));

            grid1.AutoSizeAll();
        }
예제 #2
0
 private void frmSample16_Load(object sender, System.EventArgs e)
 {
     grid1.Redim(10, 10);
     for (int r = 0; r < grid1.RowsCount; r++)
     {
         for (int c = 0; c < grid1.ColumnsCount; c++)
         {
             grid1[r, c] = new SourceGrid2.Cells.Real.Cell("Ciao", typeof(string));
         }
     }
 }
예제 #3
0
        private void DataColumnDialog_Load(object sender, System.EventArgs e)
        {
            if (m_DataTable == null)
            {
                throw new ApplicationException("DataTable is null");
            }

            if (m_TemplateColumns == null)
            {
                m_TemplateColumns = GridDataTable.GetColumnsFromDataTable(m_DataTable, true);
            }

            grid.Redim(m_DataTable.Columns.Count + 1, 3);
            grid.FixedRows = 1;
            grid.Selection.SelectionMode = SourceGrid2.GridSelectionMode.Row;

            grid[0, 0] = new Cells.Header("Visible");
            grid[0, 1] = new Cells.Header("Caption");
            grid[0, 2] = new Cells.Header("Order");

            int l_LastPosition = m_TemplateColumns.Length + 1;

            for (int c = 0; c < m_DataTable.Columns.Count; c++)
            {
                int  l_CurrentPosition = l_LastPosition;
                bool l_bVisible        = false;
                for (int j = 0; j < m_TemplateColumns.Length; j++)
                {
                    if (m_TemplateColumns[j].DataColumn == m_DataTable.Columns[c])
                    {
                        l_bVisible        = true;
                        l_CurrentPosition = j + 1;
                        break;
                    }
                }
                if (l_bVisible == false)
                {
                    l_LastPosition++;
                }
                grid[c + grid.FixedRows, 0]     = new Cells.CheckBox(l_bVisible);
                grid[c + grid.FixedRows, 0].Tag = m_DataTable.Columns[c];
                grid[c + grid.FixedRows, 1]     = new Cells.Cell(m_DataTable.Columns[c].Caption, typeof(string));
                grid[c + grid.FixedRows, 1].DataModel.AllowNull = false;
                grid[c + grid.FixedRows, 2] = new Cells.Cell(l_CurrentPosition);
            }

            Sort();

            grid.AutoStretchColumnsToFitWidth = true;
            grid.AutoSizeAll();
        }
예제 #4
0
        public void LoadList()
        {
            if (m_ItemType == null)
            {
                throw new ApplicationException("ItemType is null");
            }
            if (m_List == null)
            {
                m_List = new ArrayList();
            }

            if (m_Properties.Length != m_Editors.Length)
            {
                throw new ApplicationException("Properteis.Length != Editors.Length");
            }

            grid.FixedRows    = 1;
            grid.FixedColumns = 0;
            grid.Redim(m_List.Count + grid.FixedRows, m_Properties.Length + grid.FixedColumns);

            //HeaderCell
            //grid[0,0] = new Cells.Header();
            for (int i = 0; i < m_Properties.Length; i++)
            {
                Cells.ColumnHeader l_Header = new Cells.ColumnHeader(m_Properties[i].Name);

                grid[0, i + grid.FixedColumns] = l_Header;

                l_Header.EnableSort = false;
//				//If the column type support the IComparable then I can use the value to sort the column, otherwise I use the string representation for sort.
//				if (typeof(IComparable).IsAssignableFrom(m_Properties[i].PropertyType))
//					l_Header.Comparer = new SourceGrid2.ValueCellComparer();
//				else
//					l_Header.Comparer = new SourceGrid2.DisplayStringCellComparer();
            }

            for (int r = 0; r < m_List.Count; r++)
            {
                PopulateRow(r + grid.FixedRows, m_List[r]);
            }
            grid.AutoStretchRowsToFitHeight = false;

            grid.AutoStretchColumnsToFitWidth = true;


            grid.AutoSizeAll(20, 20);
        }
예제 #5
0
        private void btLoad_Click(object sender, System.EventArgs e)
        {
            //Visual properties shared between all the cells
            SourceGrid2.VisualModels.Common l_Properties = new SourceGrid2.VisualModels.Common();
            l_Properties.BackColor = Color.Snow;

            //Editor (IDataModel) shared between all the cells
            SourceGrid2.DataModels.EditorTextBox l_EditorTextBox = new SourceGrid2.DataModels.EditorTextBox(typeof(string));

            grid.Redim(int.Parse(txtRows.Text), int.Parse(txtCols.Text));

            for (int r = 0; r < grid.RowsCount; r++)
            {
                for (int c = 0; c < grid.ColumnsCount; c++)
                {
                    grid[r, c] = new Cells.Cell(r.ToString() + "," + c.ToString(), l_EditorTextBox, l_Properties);
                }
            }
        }
예제 #6
0
        private void frmSample13_Load(object sender, System.EventArgs e)
        {
            //Create a VisualModel with an image
            m_VisualModel1                = new SourceGrid2.VisualModels.Common();
            m_VisualModel1.Image          = SampleImages.FACE01;
            m_VisualModel1.ImageAlignment = ContentAlignment.MiddleRight;

            //Create another VisualModel with an image
            m_VisualModel2                = new SourceGrid2.VisualModels.Common();
            m_VisualModel2.Image          = SampleImages.FACE02;
            m_VisualModel2.ImageAlignment = ContentAlignment.MiddleRight;

            cpVisualModelForeColor.SelectedColor = m_VisualModel1.ForeColor;

            //Now Create a DataModel
            m_DataModel = new SourceGrid2.DataModels.EditorTextBox(typeof(string));

            //Create a behavior that change the VIsualModel of a cell when the user move the Mouse over the cell
            m_BehaviorModel             = new SourceGrid2.BehaviorModels.CustomEvents();
            m_BehaviorModel.MouseEnter += new SourceGrid2.PositionEventHandler(m_BehaviorModel_MouseEnter);
            m_BehaviorModel.MouseLeave += new SourceGrid2.PositionEventHandler(m_BehaviorModel_MouseLeave);


            //Populate the grid
            grid1.Redim(2, 2);
            for (int r = 0; r < grid1.RowsCount; r++)
            {
                for (int c = 0; c < grid1.ColumnsCount; c++)
                {
                    SourceGrid2.Cells.Real.Cell l_Cell = new SourceGrid2.Cells.Real.Cell();
                    l_Cell.Value       = r.ToString() + " " + c.ToString();
                    l_Cell.VisualModel = m_VisualModel1;
                    l_Cell.DataModel   = m_DataModel;
                    l_Cell.Behaviors.Add(m_BehaviorModel);
                    grid1[r, c] = l_Cell;
                }
            }

            //Now Set the width of the column
            grid1.Columns[0].Width = grid1.DisplayRectangle.Width / 2;
            grid1.Columns[1].Width = grid1.DisplayRectangle.Width / 2;
        }
예제 #7
0
        private void frmSample8_Load(object sender, System.EventArgs e)
        {
            grid.Redim(10, 5);

            DebugBehavior l_DebugBehavior = new DebugBehavior(this);

            for (int r = 0; r < grid.RowsCount; r++)
            {
                for (int c = 0; c < grid.ColumnsCount; c++)
                {
                    grid[r, c]           = new Cells.Cell();
                    grid[r, c].DataModel = new SourceGrid2.DataModels.EditorTextBox(typeof(string));
                    grid[r, c].Value     = grid[r, c].Range.Start.ToString();
                    grid[r, c].Behaviors.Add(l_DebugBehavior);
                }
            }

            grid.AutoStretchColumnsToFitWidth = true;
            grid.AutoSizeAll();
        }
예제 #8
0
        public void LoadList()
        {
            if (m_ItemType == null)
            {
                throw new ApplicationException("ItemType is null");
            }
            if (m_List == null)
            {
                m_List = new ArrayList();
            }

            if (m_Properties.Length != m_Editors.Length)
            {
                throw new ApplicationException("Properteis.Length != Editors.Length");
            }

            grid.FixedRows    = 1;
            grid.FixedColumns = 0;
            grid.Redim(m_List.Count + grid.FixedRows, m_Properties.Length + grid.FixedColumns);

            //HeaderCell
            //grid[0,0] = new Cells.Header();
            for (int i = 0; i < m_Properties.Length; i++)
            {
                Cells.ColumnHeader l_Header;
                if (ItemType.Name == "ChartBarTextDefine")
                {
                    if (CComLibrary.GlobeVal.languageselect == 0)
                    {
                        string[] na = { "文档名称", "文档内容", "内部名称" };
                        l_Header = new Cells.ColumnHeader(na[i]);
                    }
                    else
                    {
                        string[] na = { "Document name", "Document Value", "Internal name" };
                        l_Header = new Cells.ColumnHeader(na[i]);
                    }
                }
                else if (ItemType.Name == "ChartBarComboDefine")
                {
                    if (CComLibrary.GlobeVal.languageselect == 0)
                    {
                        string[] na = { "组合框名称", "组合框内容", "选择" };
                        l_Header = new Cells.ColumnHeader(na[i]);
                    }
                    else
                    {
                        string[] na = { "Combo name", "Combo value", "Selection" };
                        l_Header = new Cells.ColumnHeader(na[i]);
                    }
                }
                else
                {
                    l_Header = new Cells.ColumnHeader(m_Properties[i].Name);
                }
                grid[0, i + grid.FixedColumns] = l_Header;

                l_Header.EnableSort = false;
//				//If the column type support the IComparable then I can use the value to sort the column, otherwise I use the string representation for sort.
//				if (typeof(IComparable).IsAssignableFrom(m_Properties[i].PropertyType))
//					l_Header.Comparer = new SourceGrid2.ValueCellComparer();
//				else
//					l_Header.Comparer = new SourceGrid2.DisplayStringCellComparer();
            }

            for (int r = 0; r < m_List.Count; r++)
            {
                PopulateRow(r + grid.FixedRows, m_List[r]);
            }
            grid.AutoStretchRowsToFitHeight = false;

            grid.AutoStretchColumnsToFitWidth = true;


            grid.AutoSizeAll(20, 20);
        }
예제 #9
0
        public void LoadChart()
        {
            grid.Redim(0, 0);
            if (Bars.Count > 0)
            {
                double l_Max = double.MinValue;
                double l_Min = double.MaxValue;
                for (int i = 0; i < m_Bars.Count; i++)
                {
                    if (m_Bars[i].值 > l_Max)
                    {
                        l_Max = m_Bars[i].值;
                    }

                    if (m_Bars[i].值 < l_Min)
                    {
                        l_Min = m_Bars[i].值;
                    }
                }

                //l_Min -= ((l_Max-l_Min)/((double)m_StepNumber))*2;//per fare in modo che ance il pi?piccolo sia visibile
                double l_ScalingFactor = ((double)m_StepNumber) / (l_Max - l_Min);

                //Draw Background
                SourceGrid2.VisualModels.Common l_TopBorderModel = new SourceGrid2.VisualModels.Common(false);
                l_TopBorderModel.Border        = new SourceGrid2.RectangleBorder(new SourceGrid2.Border(Color.Black, 1), new SourceGrid2.Border(Color.Black, 0), new SourceGrid2.Border(Color.Black, 0), new SourceGrid2.Border(Color.Black, 0));
                l_TopBorderModel.BackColor     = grid.BackColor;
                l_TopBorderModel.TextAlignment = ContentAlignment.MiddleCenter;
                SourceGrid2.VisualModels.Common l_RightBorderModel = new SourceGrid2.VisualModels.Common(false);
                l_RightBorderModel.Border        = new SourceGrid2.RectangleBorder(new SourceGrid2.Border(Color.Black, 0), new SourceGrid2.Border(Color.Black, 0), new SourceGrid2.Border(Color.Black, 0), new SourceGrid2.Border(Color.Black, 1));
                l_RightBorderModel.BackColor     = grid.BackColor;
                l_RightBorderModel.TextAlignment = ContentAlignment.BottomRight;
                SourceGrid2.VisualModels.Common l_RightTopBorderModel = new SourceGrid2.VisualModels.Common(false);
                l_RightTopBorderModel.Border    = new SourceGrid2.RectangleBorder(new SourceGrid2.Border(Color.Black, 1), new SourceGrid2.Border(Color.Black, 0), new SourceGrid2.Border(Color.Black, 0), new SourceGrid2.Border(Color.Black, 1));
                l_RightTopBorderModel.BackColor = grid.BackColor;

                grid.Redim(m_StepNumber + 2, m_Bars.Count * 2 + 2);            //+ 1 per gli header e per uno spazio in alto e in basso

                //barra X
                for (int c = 1; c < grid.ColumnsCount; c++)
                {
                    grid[grid.RowsCount - 1, c] = new Cells.Cell((object)null, null, l_TopBorderModel);
                }

                //barra Y
                double l_YValue = l_Max;
                for (int r = 0; r < grid.RowsCount - 1; r++)
                {
                    grid[r, 0] = new Cells.Cell(l_YValue.ToString() + " _", null, l_RightBorderModel);
                    l_YValue  -= 1 / l_ScalingFactor;
                }

                //left bottom cell
                grid[grid.RowsCount - 1, 0] = new Cells.Cell((object)null, null, l_RightTopBorderModel);

                //bars header
                int l_Col = 2;
                foreach (ChartBar bar in Bars)
                {
                    grid[grid.RowsCount - 1, l_Col] = new Cells.Cell(bar.称 + "\n" + bar.值.ToString(), null, l_TopBorderModel);

                    l_Col += 2;
                }

                grid.AutoStretchColumnsToFitWidth = true;
                grid.AutoStretchRowsToFitHeight   = true;
                grid.AutoSizeAll(5, 5);

                //bars
                l_Col = 2;
                foreach (ChartBar bar in Bars)
                {
                    int l_ScaledValue = (int)((bar.值 - l_Min) * l_ScalingFactor);

                    if (l_ScaledValue > 0)
                    {
                        grid[(StepNumber - l_ScaledValue) + 1, l_Col]         = bar.CreateCell();
                        grid[(StepNumber - l_ScaledValue) + 1, l_Col].RowSpan = l_ScaledValue;
                    }

                    grid[grid.RowsCount - 1, l_Col] = new Cells.Cell(bar.称 + "\n" + bar.值.ToString(), null, l_TopBorderModel);

                    l_Col += 2;
                }
            }
        }
예제 #10
0
        private void StartForm_Load(object sender, System.EventArgs e)
        {
            grid.Redim(39, 3);
            grid.BackColor = Color.WhiteSmoke;

            #region VisualProperties
            SourceGrid2.VisualModels.Common l_PropertiesCaption = new SourceGrid2.VisualModels.Common();
            l_PropertiesCaption.Border        = SourceGrid2.RectangleBorder.NoBorder;
            l_PropertiesCaption.BackColor     = grid.BackColor;
            l_PropertiesCaption.Font          = new Font(FontFamily.GenericSansSerif, 12, FontStyle.Bold);
            l_PropertiesCaption.TextAlignment = ContentAlignment.MiddleCenter;

            SourceGrid2.VisualModels.Common l_PropertiesLink = (SourceGrid2.VisualModels.Common)SourceGrid2.VisualModels.Common.LinkStyle.Clone(false);
            l_PropertiesLink.Border        = new SourceGrid2.RectangleBorder(new SourceGrid2.Border(Color.Gray, 1));
            l_PropertiesLink.TextAlignment = ContentAlignment.MiddleCenter;

            SourceGrid2.VisualModels.Common l_PropertiesDescription = new SourceGrid2.VisualModels.Common();
            l_PropertiesDescription.Border    = SourceGrid2.RectangleBorder.NoBorder;
            l_PropertiesDescription.BackColor = grid.BackColor;

            SourceGrid2.VisualModels.Common l_PropertiesVersion = (SourceGrid2.VisualModels.Common)(SourceGrid2.VisualModels.Common.LinkStyle.Clone(false));
            l_PropertiesVersion.Border        = SourceGrid2.RectangleBorder.NoBorder;
            l_PropertiesVersion.BackColor     = grid.BackColor;
            l_PropertiesVersion.TextAlignment = ContentAlignment.TopRight;

            SourceGrid2.VisualModels.Common l_PropertiesRegion = new SourceGrid2.VisualModels.Common();
            l_PropertiesRegion.Border        = SourceGrid2.RectangleBorder.RectangleBlack1Width;
            l_PropertiesRegion.BackColor     = Color.SteelBlue;
            l_PropertiesRegion.ForeColor     = Color.White;
            l_PropertiesRegion.TextAlignment = ContentAlignment.MiddleCenter;
            #endregion

            #region Caption
            grid[1, 1]             = new Cells.Cell("SourceGrid 2");
            grid[1, 1].VisualModel = l_PropertiesCaption;
            grid[1, 1].ColumnSpan  = 2;

            Cells.Link l_CellVersion = new Cells.Link("V." + GetSourceGridFileVersion());
            grid[0, 2]                = l_CellVersion;
            grid[0, 2].VisualModel    = l_PropertiesVersion;
            l_CellVersion.ToolTipText = "www.devage.com";
            l_CellVersion.Click      += new SourceGrid2.PositionEventHandler(l_CellVersion_Click);
            #endregion

            int l_CurrentRow = 3;

            #region Basic Operations
            grid[l_CurrentRow, 1]            = new SourceGrid2.Cells.Real.Cell("Basic Operations", null, l_PropertiesRegion);
            grid[l_CurrentRow, 1].ColumnSpan = 2;
            l_CurrentRow++;

            #region Sample 14
            grid[l_CurrentRow, 1]             = new CellLinkSample("Sample 14", typeof(frmSample14));
            grid[l_CurrentRow, 1].VisualModel = l_PropertiesLink;

            grid[l_CurrentRow, 2]             = new Cells.Cell("First Example Grid");
            grid[l_CurrentRow, 2].VisualModel = l_PropertiesDescription;

            l_CurrentRow += 2;
            #endregion

            #region Sample 13
            grid[l_CurrentRow, 1]             = new CellLinkSample("Sample 13", typeof(frmSample13));
            grid[l_CurrentRow, 1].VisualModel = l_PropertiesLink;

            grid[l_CurrentRow, 2]             = new Cells.Cell("Basic Grid Operations - Grid, Cell, DataModel, VisualModel, BehaviorModel");
            grid[l_CurrentRow, 2].VisualModel = l_PropertiesDescription;

            l_CurrentRow += 2;
            #endregion

            #region Sample 3
            grid[l_CurrentRow, 1]             = new CellLinkSample("Sample 3", typeof(frmSample3));
            grid[l_CurrentRow, 1].VisualModel = l_PropertiesLink;

            grid[l_CurrentRow, 2]             = new Cells.Cell("Cell Editors, Special Cells, Formatting and Image");
            grid[l_CurrentRow, 2].VisualModel = l_PropertiesDescription;

            l_CurrentRow += 2;
            #endregion
            #endregion

            #region Real Grids
            grid[l_CurrentRow, 1]            = new SourceGrid2.Cells.Real.Cell("Real Grids", null, l_PropertiesRegion);
            grid[l_CurrentRow, 1].ColumnSpan = 2;
            l_CurrentRow++;

            #region Sample 1
            grid[l_CurrentRow, 1]             = new CellLinkSample("Sample 1", typeof(frmSample1));
            grid[l_CurrentRow, 1].VisualModel = l_PropertiesLink;

            grid[l_CurrentRow, 2]             = new Cells.Cell("Fixed Cells, Sort, Resize, Editors, MoveColumns, Add/Remove Rows (Standard Grid)");
            grid[l_CurrentRow, 2].VisualModel = l_PropertiesDescription;

            l_CurrentRow += 2;
            #endregion

            #region Sample 4
            grid[l_CurrentRow, 1]             = new CellLinkSample("Sample 4", typeof(frmSample4));
            grid[l_CurrentRow, 1].VisualModel = l_PropertiesLink;

            grid[l_CurrentRow, 2]             = new Cells.Cell("Grid Performance (static Cell + Shared VisualProperties and Editor)");
            grid[l_CurrentRow, 2].VisualModel = l_PropertiesDescription;

            l_CurrentRow += 2;
            #endregion
            #endregion

            #region Virtual Grids
            grid[l_CurrentRow, 1]            = new SourceGrid2.Cells.Real.Cell("Virtual Grids", null, l_PropertiesRegion);
            grid[l_CurrentRow, 1].ColumnSpan = 2;
            grid[l_CurrentRow, 0]            = new CellNew();
            l_CurrentRow++;

            #region Sample 15
            grid[l_CurrentRow, 1]             = new CellLinkSample("Sample 15", typeof(frmSample15));
            grid[l_CurrentRow, 1].VisualModel = l_PropertiesLink;

            grid[l_CurrentRow, 2]             = new Cells.Cell("Virtual Grid - Simple Array Binding");
            grid[l_CurrentRow, 2].VisualModel = l_PropertiesDescription;

            l_CurrentRow += 2;
            #endregion

            #region Sample 5
            grid[l_CurrentRow, 1]             = new CellLinkSample("Sample 5", typeof(frmSample5));
            grid[l_CurrentRow, 1].VisualModel = l_PropertiesLink;

            grid[l_CurrentRow, 2]             = new Cells.Cell("Virtual Grid - ReadOnly Grid with auto generated values");
            grid[l_CurrentRow, 2].VisualModel = l_PropertiesDescription;

            l_CurrentRow += 2;
            #endregion

            #region Sample 6
            grid[l_CurrentRow, 1]             = new CellLinkSample("Sample 6", typeof(frmSample6));
            grid[l_CurrentRow, 1].VisualModel = l_PropertiesLink;

            grid[l_CurrentRow, 2]             = new Cells.Cell("Virtual Grid - Array Binding");
            grid[l_CurrentRow, 2].VisualModel = l_PropertiesDescription;

            l_CurrentRow += 2;
            #endregion

            #region Sample 9
            grid[l_CurrentRow, 1]             = new CellLinkSample("Sample 9", typeof(frmSample9));
            grid[l_CurrentRow, 1].VisualModel = l_PropertiesLink;

            grid[l_CurrentRow, 2]             = new Cells.Cell("Virtual Grid - DataTable Binding");
            grid[l_CurrentRow, 2].VisualModel = l_PropertiesDescription;

            l_CurrentRow += 2;
            #endregion

            #region Sample 11
            grid[l_CurrentRow, 1]             = new CellLinkSample("Sample 11", typeof(frmSample11));
            grid[l_CurrentRow, 1].VisualModel = l_PropertiesLink;

            grid[l_CurrentRow, 2]             = new Cells.Cell("Virtual Grid - WorkSheet Style Grid");
            grid[l_CurrentRow, 2].VisualModel = l_PropertiesDescription;

            l_CurrentRow += 2;
            #endregion

            #region Sample 12
            grid[l_CurrentRow, 1]             = new CellLinkSample("Sample 12", typeof(frmSample12));
            grid[l_CurrentRow, 1].VisualModel = l_PropertiesLink;

            grid[l_CurrentRow, 2]             = new Cells.Cell("Virtual Grid - Xml Binding and Virtuals Cells");
            grid[l_CurrentRow, 2].VisualModel = l_PropertiesDescription;

            l_CurrentRow += 2;
            #endregion
            #endregion

            #region Unusual Grids
            grid[l_CurrentRow, 1]            = new SourceGrid2.Cells.Real.Cell("Unusual Grids", null, l_PropertiesRegion);
            grid[l_CurrentRow, 1].ColumnSpan = 2;
            l_CurrentRow++;

            #region Sample 7
            grid[l_CurrentRow, 1]             = new CellLinkSample("Sample 7", typeof(frmSample7));
            grid[l_CurrentRow, 1].VisualModel = l_PropertiesLink;

            grid[l_CurrentRow, 2]             = new Cells.Cell("Generic List Editor + Chart Bar Simulation 2");
            grid[l_CurrentRow, 2].VisualModel = l_PropertiesDescription;

            l_CurrentRow += 2;
            #endregion

            #region Sample 2
            grid[l_CurrentRow, 1]             = new CellLinkSample("Sample 2", typeof(frmSample2));
            grid[l_CurrentRow, 1].VisualModel = l_PropertiesLink;

            grid[l_CurrentRow, 2]             = new Cells.Cell("Image, Custom Cells, Editor (Bar Chart Simulation)");
            grid[l_CurrentRow, 2].VisualModel = l_PropertiesDescription;

            l_CurrentRow += 2;
            #endregion
            #endregion

            #region Other Features
            grid[l_CurrentRow, 1]            = new SourceGrid2.Cells.Real.Cell("Other Features", null, l_PropertiesRegion);
            grid[l_CurrentRow, 1].ColumnSpan = 2;
            l_CurrentRow++;
            #region Sample 8
            grid[l_CurrentRow, 1]             = new CellLinkSample("Sample 8", typeof(frmSample8));
            grid[l_CurrentRow, 1].VisualModel = l_PropertiesLink;

            grid[l_CurrentRow, 2]             = new Cells.Cell("Cell Events and Behaviors");
            grid[l_CurrentRow, 2].VisualModel = l_PropertiesDescription;

            l_CurrentRow += 2;
            #endregion

            #region Sample 10
            grid[l_CurrentRow, 1]             = new CellLinkSample("Sample 10", typeof(frmSample10));
            grid[l_CurrentRow, 1].VisualModel = l_PropertiesLink;

            grid[l_CurrentRow, 2]             = new Cells.Cell("ContextMenu");
            grid[l_CurrentRow, 2].VisualModel = l_PropertiesDescription;

            l_CurrentRow += 2;
            #endregion

            #region Sample 16
            grid[l_CurrentRow, 1]             = new CellLinkSample("Sample 16", typeof(frmSample16));
            grid[l_CurrentRow, 1].VisualModel = l_PropertiesLink;

            grid[l_CurrentRow, 2]             = new Cells.Cell("SpecialKeys and FocusStyle");
            grid[l_CurrentRow, 2].VisualModel = l_PropertiesDescription;

            l_CurrentRow += 2;
            #endregion
            #endregion


            grid.AutoSizeAll();
            grid.AutoStretchColumnsToFitWidth = true;
            grid.StretchColumnsToFitWidth();
        }
예제 #11
0
        private void frmSample3_Load(object sender, System.EventArgs e)
        {
            grid.Redim(46, 3);

            SourceGrid2.VisualModels.Common l_TitleModel = new SourceGrid2.VisualModels.Common(false);
            l_TitleModel.BackColor     = Color.SteelBlue;
            l_TitleModel.ForeColor     = Color.White;
            l_TitleModel.TextAlignment = ContentAlignment.MiddleCenter;
            SourceGrid2.VisualModels.Common l_CaptionModel = new SourceGrid2.VisualModels.Common(false);
            l_CaptionModel.BackColor = grid.BackColor;

            int l_CurrentRow = 0;

            #region Base Types
            grid[l_CurrentRow, 0]            = new Cells.Cell("Base Types", null, l_TitleModel);
            grid[l_CurrentRow, 0].ColumnSpan = 3;
            l_CurrentRow++;

            //string
            grid[l_CurrentRow, 0] = new Cells.Cell("String", null, l_CaptionModel);

            grid[l_CurrentRow, 1] = new Cells.Cell("String Value", typeof(string));

            l_CurrentRow++;

            //double
            grid[l_CurrentRow, 0] = new Cells.Cell("Double", null, l_CaptionModel);
            grid[l_CurrentRow, 1] = new Cells.Cell(1.5, typeof(double));

            l_CurrentRow++;

            //int
            grid[l_CurrentRow, 0] = new Cells.Cell("Int", null, l_CaptionModel);
            grid[l_CurrentRow, 1] = new Cells.Cell(5, typeof(int));

            l_CurrentRow++;

            //DateTime
            grid[l_CurrentRow, 0] = new Cells.Cell("DateTime", null, l_CaptionModel);
            grid[l_CurrentRow, 1] = new Cells.Cell(DateTime.Now, typeof(DateTime));

            l_CurrentRow++;

            //Boolean
            grid[l_CurrentRow, 0] = new Cells.Cell("Boolean", null, l_CaptionModel);
            grid[l_CurrentRow, 1] = new Cells.Cell(true, typeof(Boolean));

            l_CurrentRow++;
            #endregion

            #region Complex Types
            grid[l_CurrentRow, 0]            = new Cells.Cell("Complex Types", null, l_TitleModel);
            grid[l_CurrentRow, 0].ColumnSpan = 3;
            l_CurrentRow++;

            //Font
            grid[l_CurrentRow, 0] = new Cells.Cell("Font", null, l_CaptionModel);

            grid[l_CurrentRow, 1] = new Cells.Cell(this.Font, typeof(Font));

            l_CurrentRow++;

            //Cursor
            grid[l_CurrentRow, 0] = new Cells.Cell("Cursor", null, l_CaptionModel);

            grid[l_CurrentRow, 1] = new Cells.Cell(Cursors.Arrow, typeof(Cursor));

            l_CurrentRow++;

            //Point
            grid[l_CurrentRow, 0] = new Cells.Cell("Point", null, l_CaptionModel);

            grid[l_CurrentRow, 1] = new Cells.Cell(new Point(2, 3), typeof(Point));

            l_CurrentRow++;

            //Rectangle
            grid[l_CurrentRow, 0] = new Cells.Cell("Rectangle", null, l_CaptionModel);

            grid[l_CurrentRow, 1] = new Cells.Cell(new Rectangle(100, 100, 200, 200), typeof(Rectangle));

            l_CurrentRow++;

            //Image
            grid[l_CurrentRow, 0] = new Cells.Cell("Image", null, l_CaptionModel);

            grid[l_CurrentRow, 1] = new Cells.Cell(null, typeof(Image));

            l_CurrentRow++;

            //Enum AnchorStyle
            grid[l_CurrentRow, 0] = new Cells.Cell("AnchorStyle", null, l_CaptionModel);

            grid[l_CurrentRow, 1] = new Cells.Cell(AnchorStyles.Bottom, typeof(AnchorStyles));

            l_CurrentRow++;

            //Enum
            grid[l_CurrentRow, 0] = new Cells.Cell("Enum", null, l_CaptionModel);
            grid[l_CurrentRow, 1] = new Cells.Cell(System.Windows.Forms.BorderStyle.Fixed3D, typeof(System.Windows.Forms.BorderStyle));

            l_CurrentRow++;
            #endregion

            #region Special Editors and Cells
            grid[l_CurrentRow, 0]            = new Cells.Cell("Special Editors and Cells", null, l_TitleModel);
            grid[l_CurrentRow, 0].ColumnSpan = 3;
            l_CurrentRow++;

            //Double Chars Validation
            grid[l_CurrentRow, 0] = new Cells.Cell("Double Chars Validation", null, l_CaptionModel);
            SourceGrid2.DataModels.EditorTextBoxNumeric l_NumericEditor = new SourceGrid2.DataModels.EditorTextBoxNumeric(typeof(double));
            l_NumericEditor.NumericCharStyle = SourceLibrary.Windows.Forms.NumericCharStyle.DecimalSeparator | SourceLibrary.Windows.Forms.NumericCharStyle.NegativeSymbol;
            grid[l_CurrentRow, 1]            = new Cells.Cell(0.5, l_NumericEditor);

            l_CurrentRow++;

            //String Chars (ABC)
            grid[l_CurrentRow, 0] = new Cells.Cell("String Chars Validation(only ABC)", null, l_CaptionModel);
            SourceGrid2.DataModels.EditorTextBox l_StringEditor = new SourceGrid2.DataModels.EditorTextBox(typeof(string));
            l_StringEditor.ValidCharacters = new char[] { 'A', 'B', 'C' };
            grid[l_CurrentRow, 1]          = new Cells.Cell("AABB", l_StringEditor);

            l_CurrentRow++;

            //Int 0-100 or null
            grid[l_CurrentRow, 0] = new Cells.Cell("Int 0-100 or null", null, l_CaptionModel);
            SourceGrid2.DataModels.EditorTextBoxNumeric l_NumericEditor0_100 = new SourceGrid2.DataModels.EditorTextBoxNumeric(typeof(int));
            l_NumericEditor0_100.NumericCharStyle = SourceLibrary.Windows.Forms.NumericCharStyle.None;
            l_NumericEditor0_100.MinimumValue     = 0;
            l_NumericEditor0_100.MaximumValue     = 100;
            l_NumericEditor0_100.AllowNull        = true;
            grid[l_CurrentRow, 1] = new Cells.Cell(7, l_NumericEditor0_100);

            l_CurrentRow++;

            //Enum Custom Display
            grid[l_CurrentRow, 0] = new Cells.Cell("Enum Custom Display", null, l_CaptionModel);
            SourceGrid2.DataModels.EditorComboBox l_KeysCombo = new SourceGrid2.DataModels.EditorComboBox(typeof(Keys));
            l_KeysCombo.ConvertingValueToDisplayString += new SourceLibrary.ComponentModel.ConvertingObjectEventHandler(l_KeysCombo_ConvertingValueToDisplayString);
            grid[l_CurrentRow, 1]           = new Cells.Cell(Keys.Enter);
            grid[l_CurrentRow, 1].DataModel = l_KeysCombo;

            l_CurrentRow++;

            string[] l_CmbArr = new string[] { "Value 1", "Value 2", "Value 3" };
            //ComboBox 1
            grid[l_CurrentRow, 0] = new Cells.Cell("ComboBox String", null, l_CaptionModel);
            grid[l_CurrentRow, 1] = new Cells.ComboBox(l_CmbArr[0], typeof(string), l_CmbArr, false);

            l_CurrentRow++;

            //ComboBox 2
            grid[l_CurrentRow, 0] = new Cells.Cell("ComboBox String Exclusive", null, l_CaptionModel);
            grid[l_CurrentRow, 1] = new Cells.ComboBox(l_CmbArr[0], typeof(string), l_CmbArr, true);

            l_CurrentRow++;

            //ComboBox 3
            grid[l_CurrentRow, 0] = new Cells.Cell("ComboBox String No TextBox", null, l_CaptionModel);
            grid[l_CurrentRow, 1] = new Cells.ComboBox(l_CmbArr[0], typeof(string), l_CmbArr, true);
            grid[l_CurrentRow, 1].DataModel.AllowStringConversion = false;

            l_CurrentRow++;

            //ComboBox DateTime Editable
            grid[l_CurrentRow, 0] = new Cells.Cell("ComboBox DateTime", null, l_CaptionModel);
            DateTime[] l_CmbArrDt = new DateTime[] { new DateTime(1981, 10, 6), new DateTime(1991, 10, 6), new DateTime(2001, 10, 6) };
            grid[l_CurrentRow, 1] = new Cells.ComboBox(l_CmbArrDt[0], typeof(DateTime), l_CmbArrDt, false);

            l_CurrentRow++;

            //ComboBox Custom Display (create a datamodel that has a custom display string)
            grid[l_CurrentRow, 0] = new Cells.Cell("ComboBox Custom Display", null, l_CaptionModel);
            int[] l_CmbArrInt = new int[] { 0, 1, 2, 3, 4 };
            SourceGrid2.DataModels.EditorComboBox l_ComboBoxDescription        = new SourceGrid2.DataModels.EditorComboBox(typeof(int), l_CmbArrInt, true);
            SourceLibrary.ComponentModel.Validator.ValueMapping l_ComboMapping = new SourceLibrary.ComponentModel.Validator.ValueMapping();
            l_ComboMapping.DisplayStringList = new string[] { "0 - Zero", "1 - One", "2 - Two", "3 - Three", "4- Four" };
            l_ComboMapping.ValueList         = l_CmbArrInt;
            l_ComboMapping.BindValidator(l_ComboBoxDescription);
            grid[l_CurrentRow, 1]           = new Cells.Cell(0);
            grid[l_CurrentRow, 1].DataModel = l_ComboBoxDescription;

            Cells.Cell l_CellComboRealValue = new Cells.Cell(grid[l_CurrentRow, 1].Value, null, l_CaptionModel);
            SourceGrid2.BehaviorModels.BindProperty l_ComboBindProperty = new SourceGrid2.BehaviorModels.BindProperty(typeof(Cells.Cell).GetProperty("Value"), l_CellComboRealValue);
            grid[l_CurrentRow, 1].Behaviors.Add(l_ComboBindProperty);
            grid[l_CurrentRow, 2] = l_CellComboRealValue;

            l_CurrentRow++;

            //Numeric Up Down Editor
            grid[l_CurrentRow, 0] = new Cells.Cell("NumericUpDown", null, l_CaptionModel);

            grid[l_CurrentRow, 1] = new Cells.Cell(0);
            SourceGrid2.DataModels.EditorNumericUpDown l_NumericUpDownEditor = new SourceGrid2.DataModels.EditorNumericUpDown(typeof(int), 100, 0, 1);
            grid[l_CurrentRow, 1].DataModel = l_NumericUpDownEditor;

            l_CurrentRow++;

            //Multiline Textbox
            grid[l_CurrentRow, 0]            = new Cells.Cell("Multiline Textbox", null, l_CaptionModel);
            grid[l_CurrentRow, 0].ColumnSpan = 1;
            grid[l_CurrentRow, 0].RowSpan    = 2;

            grid[l_CurrentRow, 1] = new Cells.Cell("Hello\r\nWorld");
            SourceGrid2.DataModels.EditorTextBox l_MultilineEditor = new SourceGrid2.DataModels.EditorTextBox(typeof(string));
            l_MultilineEditor.Multiline     = true;
            grid[l_CurrentRow, 1].DataModel = l_MultilineEditor;
            grid[l_CurrentRow, 1].RowSpan   = 2;

            l_CurrentRow++;
            l_CurrentRow++;

            //Boolean (CheckBox)
            grid[l_CurrentRow, 0] = new Cells.Cell("Boolean (CheckBox)", null, l_CaptionModel);
            grid[l_CurrentRow, 1] = new Cells.CheckBox(true);

            Cells.CheckBox l_DisabledCheckBox = new Cells.CheckBox("Disabled Checkbox", true);
            l_DisabledCheckBox.EnableEdit = false;
            grid[l_CurrentRow, 2]         = l_DisabledCheckBox;

            l_CurrentRow++;

            //Cell Button
            grid[l_CurrentRow, 1] = new Cells.Button("CellButton");

            l_CurrentRow++;

            //Cell Link
            grid[l_CurrentRow, 1] = new Cells.Link("CellLink");

            l_CurrentRow++;

            #endregion

            #region Custom Formatting
            grid[l_CurrentRow, 0]            = new Cells.Cell("Custom Formatting", null, l_TitleModel);
            grid[l_CurrentRow, 0].ColumnSpan = 3;
            l_CurrentRow++;

            //Percent Editor
            grid[l_CurrentRow, 0] = new Cells.Cell("Percent Format", null, l_CaptionModel);

            grid[l_CurrentRow, 1] = new Cells.Cell(0.5);
            SourceGrid2.DataModels.EditorTextBox l_PercentEditor = new SourceGrid2.DataModels.EditorTextBox(typeof(double));
            l_PercentEditor.TypeConverter   = new SourceLibrary.ComponentModel.Converter.PercentTypeConverter(typeof(double));
            grid[l_CurrentRow, 1].DataModel = l_PercentEditor;

            l_CurrentRow++;

            //Currency Editor
            grid[l_CurrentRow, 0] = new Cells.Cell("Currency Format", null, l_CaptionModel);

            grid[l_CurrentRow, 1] = new Cells.Cell(50.0M);
            SourceGrid2.DataModels.EditorTextBox l_CurrencyEditor = new SourceGrid2.DataModels.EditorTextBox(typeof(decimal));
            l_CurrencyEditor.TypeConverter  = new SourceLibrary.ComponentModel.Converter.CurrencyTypeConverter(typeof(decimal));
            grid[l_CurrentRow, 1].DataModel = l_CurrencyEditor;

            l_CurrentRow++;

            //Custom Format Number Editor
            grid[l_CurrentRow, 0] = new Cells.Cell("Custom Format Number", null, l_CaptionModel);

            Cells.Cell l_CellNumberEditor = new Cells.Cell(84.23);
            SourceGrid2.DataModels.EditorTextBox l_CustomFormatEditor = new SourceGrid2.DataModels.EditorTextBox(typeof(double));
            l_CustomFormatEditor.EnableEdit = false;

            SourceLibrary.ComponentModel.Converter.NumberTypeConverter l_NumberConverter = new SourceLibrary.ComponentModel.Converter.NumberTypeConverter(typeof(double));
            l_CustomFormatEditor.TypeConverter = l_NumberConverter;
            l_CellNumberEditor.DataModel       = l_CustomFormatEditor;
            l_CellNumberEditor.VisualModel     = l_CaptionModel;
            grid[l_CurrentRow, 1] = l_CellNumberEditor;

            grid[l_CurrentRow, 2] = new Cells.ComboBox(l_NumberConverter.Format, typeof(string), new string[] { "G", "C", "P", "000.00", "#.000" }, false);
            SourceGrid2.BehaviorModels.BindProperty l_BindProperty = new SourceGrid2.BehaviorModels.BindProperty(typeof(SourceLibrary.ComponentModel.Converter.NumberTypeConverter).GetProperty("Format"), l_NumberConverter);
            grid[l_CurrentRow, 2].Behaviors.Add(l_BindProperty);
            SourceGrid2.BehaviorModels.CustomEvents l_Event = new SourceGrid2.BehaviorModels.CustomEvents();
            l_Event.ValueChanged += new SourceGrid2.PositionEventHandler(CellCustomFormat_ValueChanged);
            grid[l_CurrentRow, 2].Behaviors.Add(l_Event);

            l_CurrentRow++;

            //DateTime 2 (using custom formatting)
            string l_FormatDt2 = "yyyy MM dd";
            grid[l_CurrentRow, 0] = new Cells.Cell("Date(" + l_FormatDt2 + ")", null, l_CaptionModel);

            string[] l_ParseFormat = new string[] { l_FormatDt2 };
            System.Globalization.DateTimeStyles l_dtStyles = System.Globalization.DateTimeStyles.AllowInnerWhite | System.Globalization.DateTimeStyles.AllowLeadingWhite | System.Globalization.DateTimeStyles.AllowTrailingWhite | System.Globalization.DateTimeStyles.AllowWhiteSpaces;
            TypeConverter l_dtConverter = new SourceLibrary.ComponentModel.Converter.DateTimeTypeConverter(l_FormatDt2, l_ParseFormat, l_dtStyles);
            string        tmp           = l_dtConverter.ConvertToString(DateTime.Today);
            DateTime      l_dtValue     = (DateTime)l_dtConverter.ConvertFromString(tmp);

            SourceGrid2.DataModels.EditorUITypeEditor l_editorDt2 = new SourceGrid2.DataModels.EditorUITypeEditor(typeof(DateTime));
            l_editorDt2.TypeConverter = l_dtConverter;
            grid[l_CurrentRow, 1]     = new Cells.Cell(DateTime.Today, l_editorDt2);

            l_CurrentRow++;

            #endregion

            #region Image And Text Properties
            grid[l_CurrentRow, 0]            = new Cells.Cell("Image And Text Properties", null, l_TitleModel);
            grid[l_CurrentRow, 0].ColumnSpan = 3;
            l_CurrentRow++;

            //Cell Image
            Cells.Cell l_CellImage1 = new Cells.Cell("Single Image", null, l_CaptionModel);
            grid[l_CurrentRow, 2] = l_CellImage1;
            l_CellImage1.RowSpan  = 5;
            SourceGrid2.VisualModels.Common l_ModelImage = new SourceGrid2.VisualModels.Common(false);
            l_ModelImage.Image       = SampleImages.FACE02;
            l_CellImage1.VisualModel = l_ModelImage;

            grid[l_CurrentRow, 0] = new Cells.Cell("Image Alignment", null, l_CaptionModel);
            grid[l_CurrentRow, 1] = new Cells.Cell(l_ModelImage.ImageAlignment, typeof(ContentAlignment));
            grid[l_CurrentRow, 1].Behaviors.Add(new SourceGrid2.BehaviorModels.BindProperty(typeof(SourceGrid2.VisualModels.Common).GetProperty("ImageAlignment"), l_ModelImage));

            l_CurrentRow++;

            grid[l_CurrentRow, 0] = new Cells.Cell("Stretch Image", null, l_CaptionModel);
            grid[l_CurrentRow, 1] = new Cells.Cell(l_ModelImage.ImageStretch, typeof(bool));
            grid[l_CurrentRow, 1].Behaviors.Add(new SourceGrid2.BehaviorModels.BindProperty(typeof(SourceGrid2.VisualModels.Common).GetProperty("ImageStretch"), l_ModelImage));

            l_CurrentRow++;

            grid[l_CurrentRow, 0] = new Cells.Cell("Text Alignment", null, l_CaptionModel);
            grid[l_CurrentRow, 1] = new Cells.Cell(l_ModelImage.TextAlignment, typeof(ContentAlignment));
            grid[l_CurrentRow, 1].Behaviors.Add(new SourceGrid2.BehaviorModels.BindProperty(typeof(SourceGrid2.VisualModels.Common).GetProperty("TextAlignment"), l_ModelImage));

            l_CurrentRow++;

            grid[l_CurrentRow, 0] = new Cells.Cell("AlignTextToImage", null, l_CaptionModel);
            grid[l_CurrentRow, 1] = new Cells.Cell(l_ModelImage.AlignTextToImage, typeof(bool));
            grid[l_CurrentRow, 1].Behaviors.Add(new SourceGrid2.BehaviorModels.BindProperty(typeof(SourceGrid2.VisualModels.Common).GetProperty("AlignTextToImage"), l_ModelImage));

            l_CurrentRow++;

            grid[l_CurrentRow, 0] = new Cells.Cell("StringFormat.FormatFlags", null, l_CaptionModel);
            grid[l_CurrentRow, 1] = new Cells.Cell(l_ModelImage.StringFormat.FormatFlags, typeof(StringFormatFlags));
            grid[l_CurrentRow, 1].Behaviors.Add(new SourceGrid2.BehaviorModels.BindProperty(typeof(StringFormat).GetProperty("FormatFlags"), l_ModelImage.StringFormat));

            l_CurrentRow++;

            // Cell VisualModelMultiImages
            grid[l_CurrentRow, 2]         = new Cells.Cell("Multi Images");
            grid[l_CurrentRow, 2].RowSpan = 5;
            SourceGrid2.VisualModels.MultiImages l_ModelMultiImages = new SourceGrid2.VisualModels.MultiImages(false);
            l_ModelMultiImages.SubImages.Add(new SourceGrid2.PositionedImage(SampleImages.FACE00, ContentAlignment.TopLeft));
            l_ModelMultiImages.SubImages.Add(new SourceGrid2.PositionedImage(SampleImages.FACE01, ContentAlignment.TopRight));
            l_ModelMultiImages.SubImages.Add(new SourceGrid2.PositionedImage(SampleImages.FACE02, ContentAlignment.BottomLeft));
            l_ModelMultiImages.SubImages.Add(new SourceGrid2.PositionedImage(SampleImages.FACE04, ContentAlignment.BottomRight));
            l_ModelMultiImages.StringFormat.FormatFlags = StringFormatFlags.DirectionVertical;
            grid[l_CurrentRow, 2].VisualModel           = l_ModelMultiImages;

            l_CurrentRow++;
            l_CurrentRow++;
            l_CurrentRow++;
            l_CurrentRow++;
            #endregion


            grid.AutoSizeAll();
            grid.AutoStretchColumnsToFitWidth = true;
            grid.StretchColumnsToFitWidth();
        }
예제 #12
0
        public void LoadList()
        {
            if (m_ItemType == null)
            {
                throw new ApplicationException("ItemType is null");
            }
            if (m_List == null)
            {
                m_List = new ArrayList();
            }

            if (m_Properties.Length != m_Editors.Length)
            {
                throw new ApplicationException("Properteis.Length != Editors.Length");
            }

            grid.FixedRows    = 1;
            grid.FixedColumns = 0;
            grid.Redim(m_List.Count + grid.FixedRows, m_Properties.Length + grid.FixedColumns);

            //HeaderCell
            //grid[0,0] = new Cells.Header();
            for (int i = 0; i < m_Properties.Length; i++)
            {
                Cells.ColumnHeader l_Header;

                if (ItemType.Name == "ChartBar")
                {
                    if (CComLibrary.GlobeVal.languageselect == 0)
                    {
                        string[] na = { "名称", "值", "单位", "量纲" };
                        l_Header = new Cells.ColumnHeader(na[i]);
                    }
                    else
                    {
                        string[] na = { "Name", "Value", "Unit", "Dimension" };
                        l_Header = new Cells.ColumnHeader(na[i]);
                    }
                }
                else if (ItemType.Name == "ChartBarDefine")
                {
                    if (CComLibrary.GlobeVal.languageselect == 0)
                    {
                        string[] na = { "公式名称", "公式内容", "公式单位", "是否计算", "公式说明", "曲线显示", "量纲" };
                        l_Header = new Cells.ColumnHeader(na[i]);
                    }
                    else
                    {
                        string[] na = { "Formula name", "Formula content", "Formula unit", "Calculation", "Formula description", "Display on curves", "Dimension" };
                        l_Header = new Cells.ColumnHeader(na[i]);
                    }
                }
                else
                {
                    l_Header = new Cells.ColumnHeader(m_Properties[i].Name);
                }
                grid[0, i + grid.FixedColumns] = l_Header;

                l_Header.EnableSort = false;
//				//If the column type support the IComparable then I can use the value to sort the column, otherwise I use the string representation for sort.
//				if (typeof(IComparable).IsAssignableFrom(m_Properties[i].PropertyType))
//					l_Header.Comparer = new SourceGrid2.ValueCellComparer();
//				else
//					l_Header.Comparer = new SourceGrid2.DisplayStringCellComparer();
            }

            for (int r = 0; r < m_List.Count; r++)
            {
                PopulateRow(r + grid.FixedRows, m_List[r]);
            }
            grid.AutoStretchRowsToFitHeight = false;

            grid.AutoStretchColumnsToFitWidth = true;


            grid.AutoSizeAll(20, 20);
        }