퇴근5분전

 

 

 

private void InitGrid()
        {
            gridView1.OptionsView.ShowGroupPanel = false;

            var col1 = gridView1.Columns.Add();
            col1.FieldName = "Key";
            col1.Caption = "메뉴ID";
            col1.Width = 120;
            col1.Visible = true;

            var col2 = gridView1.Columns.Add();
            col2.FieldName = "Name";
            col2.Caption = "메뉴명";
            col2.Width = 220;
            col2.Visible = true;
            
            gridControl1.DataSource = GetDataSource();
        }

 

음.. 버튼도 넣어볼까나?

 

 

 

 

   private void InitGrid()
        {
            gridView1.OptionsView.ShowGroupPanel = false;

            var col1 = gridView1.Columns.Add();
            col1.FieldName = "Key";
            col1.Caption = "메뉴ID";
            col1.Width = 120;
            col1.Visible = true;

            var col2 = gridView1.Columns.Add();
            col2.FieldName = "Name";
            col2.Caption = "메뉴명";
            col2.Width = 220;
            col2.Visible = true;

               var col3 = gridView1.Columns.Add();
            col3.Caption = "컬럼";
            col3.Width = 150;
            col3.Visible = true;
            var redit = new DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit();
            redit.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.HideTextEditor;
            var btnEdit = new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Glyph);
            redit.Buttons.Add(btnEdit);
            redit.Buttons[0].Caption = "001";
          redit.Buttons[0].Kind = DevExpress.XtraEditors.Controls.ButtonPredefines.Glyph;
          redit.Buttons[1].Caption = "002";
          redit.Buttons[1].Kind = DevExpress.XtraEditors.Controls.ButtonPredefines.Glyph;

            redit.ButtonClick += redit_ButtonClick;
            col3.ColumnEdit = redit;             gridControl1.DataSource = GetDataSource();
        }

        void redit_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            if (e.Button.Index == 0)
            {
                MessageBox.Show(e.Button.Caption);
            }
            else if (e.Button.Index == 1)
            {
                MessageBox.Show(e.Button.Caption);
            }
        }

 

 

 

 

 

 

'# 4) .Net ( Vs 2010 ) > DevExpress' 카테고리의 다른 글

ButtonEdit  (0) 2015.01.25
TreeList  (0) 2015.01.25