Exemple #1
0
        //private void InsertColumn(int key, string name, DataGridViewContentAlignment alignHeader, DataGridViewContentAlignment alignRow, int width,Type type)
        //private void InsertColumn(int key, string name, HorzAlignment alignHeader, HorzAlignment alignRow, int width, UnboundColumnType type)
        private void InsertColumn(string name, int width, HorzAlignment alignCell, UnboundColumnType type, Type typeOri, bool readOnly)
        {
            var column = new DataGridViewTextBoxColumnEX();

            column.Name          = $"column{GV_PageHV.Columns.Count + 1}";
            column.HeaderText    = name;
            column.CellAlignment = alignCell;                              //CELL位置
            column.ColumnType    = type;
            column.SortMode      = DataGridViewColumnSortMode.NotSortable; //SORT 需設定為NOT 標題才會真的置中
            column.ValueType     = typeOri;
            column.Width         = width;
            column.ReadOnly      = readOnly;
            GV_PageHV.Columns.Add(column);
        }
Exemple #2
0
        //private void InsertColumn(int key,string name, HorzAlignment alignHeader, HorzAlignment alignRow, int width, UnboundColumnType type)
        //private void InsertColumn(int key, string name, DataGridViewContentAlignment alignHeader, DataGridViewContentAlignment alignRow, int width, Type type)
        private void InsertColumn(string name, int width, HorzAlignment alignCell, UnboundColumnType type, Type typeOri)
        {
            var column = new DataGridViewTextBoxColumnEX();

            //var column = new DataGridViewTextBoxColumn();

            /*var column = new GridColumn();
             * column.Caption = name;
             * column.AppearanceHeader.TextOptions.HAlignment = alignHeader;
             * column.AppearanceCell.TextOptions.HAlignment = alignRow;
             * column.UnboundType = type;
             * column.Width = width;
             * column.OptionsColumn.AllowSort = DefaultBoolean.False;*/

            column.Name          = $"column{GV_PageData.Columns.Count + 1}";
            column.HeaderText    = name;
            column.CellAlignment = alignCell;                              //CELL位置
            column.ColumnType    = type;
            column.SortMode      = DataGridViewColumnSortMode.NotSortable; //SORT 需設定為NOT 標題才會真的置中
            column.ValueType     = typeOri;
            column.Width         = width;
            GV_PageData.Columns.Add(column);
        }