Example #1
0
 public static void InitializeColumn(DevExpress.XtraGrid.Views.BandedGrid.AdvBandedGridView view,
                                     string ColumnName,
                                     _ColumnType type,
                                     _ColumnAlign mAlign,
                                     bool IsVisible)
 {
     try
     {
         InitializeColumnA(view, ColumnName, type, mAlign, IsVisible, false, false);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #2
0
        /// <summary>
        /// Sets the column.
        /// </summary>
        /// <param name="strheader">The strheader.</param>
        /// <param name="strFieldsName">Name of the STR fields.</param>
        /// <param name="ct">The ct.</param>
        /// <param name="nWidth">Width of the n.</param>
        /// <param name="mAlign">The m align.</param>
        /// <param name="bVisible">if set to <c>true</c> [b visible].</param>
        /// <param name="IsAllowEdit">if set to <c>true</c> [is allow edit].</param>
        /// <param name="IsAllowSort">The is allow sort.</param>
        /// <returns></returns>
        private DevExpress.XtraGrid.Columns.GridColumn SetColumn(string strheader,
                                                                 string strFieldsName,
                                                                 _ColumnType ct,
                                                                 int nWidth,
                                                                 _ColumnAlign mAlign,
                                                                 bool bVisible,
                                                                 bool IsAllowEdit,
                                                                 DefaultBoolean IsAllowSort,
                                                                 AutoFilterCondition autoFilterCondition,
                                                                 bool IsAllowMove)
        {
            DevExpress.XtraGrid.Columns.GridColumn gc = new GridColumn();

            gc.Caption   = strheader;
            gc.FieldName = strFieldsName;
            gc.Name      = strFieldsName;
            gc.Width     = nWidth;
            //// 헤더 텍스트 옵션을 사용한다.
            gc.AppearanceHeader.Options.UseTextOptions = true;
            gc.OptionsColumn.AllowMerge = DefaultBoolean.False;

            // 셀 텍스트 옵션을 사용한다.
            gc.AppearanceCell.Options.UseTextOptions   = true;
            gc.AppearanceCell.TextOptions.VAlignment   = DevExpress.Utils.VertAlignment.Default;
            gc.AppearanceCell.TextOptions.HAlignment   = (DevExpress.Utils.HorzAlignment)mAlign;
            gc.AppearanceHeader.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Default;
            gc.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;

            gc.Visible = bVisible;
            gc.OptionsColumn.AllowEdit = IsAllowEdit;
            gc.OptionsColumn.AllowMove = IsAllowMove;
            gc.OptionsColumn.ReadOnly  = !IsAllowEdit;
            gc.OptionsColumn.AllowSort = IsAllowSort;
            gc.VisibleIndex            = bVisible ? iVisibleIndex++ : -1;

            gc.OptionsFilter.AllowAutoFilter = true;
            //gc.OptionsFilter.AllowFilter               = false;
            gc.OptionsFilter.AutoFilterCondition       = autoFilterCondition;
            gc.OptionsFilter.ImmediateUpdateAutoFilter = true;
            gc.AppearanceHeader.Font            = new System.Drawing.Font("굴림체", 9F);
            gc.AppearanceHeader.Options.UseFont = true;


            if (ct > 0)
            {
                switch (ct)
                {
                case _ColumnType.CheckBox:
                    if (this._GridControl != null)
                    {
                        mCheckBox = new RepositoryItemCheckEdit();
                        this._GridControl.RepositoryItems.Add(SetCheckBoxStyle(mCheckBox, CheckBoxStyle.StyleYN));
                        gc.ColumnEdit = mCheckBox;
                        //gc.OptionsColumn.AllowEdit= true;
                        //gc.OptionsColumn.ReadOnly  = false;
                    }
                    break;

                case _ColumnType.CheckBoxBit:
                    if (this._GridControl != null)
                    {
                        mCheckBox = new RepositoryItemCheckEdit();
                        this._GridControl.RepositoryItems.Add(SetCheckBoxStyle(mCheckBox, CheckBoxStyle.StyleBit));
                        gc.ColumnEdit = mCheckBox;
                        //gc.OptionsColumn.AllowEdit= true;
                        //gc.OptionsColumn.ReadOnly  = false;
                    }
                    break;

                case _ColumnType.Picture:
                    if (this._GridControl != null)
                    {
                        mPicture          = new RepositoryItemPictureEdit();
                        mPicture.SizeMode = DevExpress.XtraEditors.Controls.PictureSizeMode.Stretch;

                        this._GridControl.RepositoryItems.Add(mPicture);
                        gc.ColumnEdit = mPicture;
                        //gc.OptionsColumn.AllowEdit= true;
                        //gc.OptionsColumn.ReadOnly  = false;
                    }
                    break;

                case _ColumnType.Numbers:
                    gc.DisplayFormat.FormatType   = FormatType.Numeric;
                    gc.DisplayFormat.FormatString = "n0";
                    break;

                case _ColumnType.Dates:
                    gc.DisplayFormat.FormatType   = FormatType.DateTime;
                    gc.DisplayFormat.FormatString = "yyyy-MM-dd";

                    break;

                case _ColumnType.DateTime:
                    gc.DisplayFormat.FormatType   = FormatType.DateTime;
                    gc.DisplayFormat.FormatString = "yyyy-MM-dd HH:mm:ss";
                    break;

                case _ColumnType.ComboBox:

                    mComboBox = new RepositoryItemComboBox();
                    mComboBox.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
                    this._GridControl.RepositoryItems.Add(mComboBox);
                    gc.ColumnEdit = mComboBox;
                    //gc.OptionsColumn.ReadOnly  = false;
                    //gc.OptionsColumn.AllowEdit= true;
                    break;

                case _ColumnType.doubles1:

                    gc.DisplayFormat.FormatType   = FormatType.Numeric;
                    gc.DisplayFormat.FormatString = "n1";
                    break;

                case _ColumnType.doubles2:

                    gc.DisplayFormat.FormatType   = FormatType.Numeric;
                    gc.DisplayFormat.FormatString = "n2";
                    break;

                case _ColumnType.TextEdit:
                    mTextEdit = new RepositoryItemTextEdit();
                    this._GridControl.RepositoryItems.Add(mTextEdit);
                    gc.ColumnEdit = mTextEdit;
                    //gc.OptionsColumn.ReadOnly  = false;
                    //gc.OptionsColumn.AllowEdit= true;
                    break;

                case _ColumnType.Amount:
                    gc.DisplayFormat.FormatType   = FormatType.Numeric;
                    gc.DisplayFormat.FormatString = "###,###";
                    break;

                case _ColumnType.LookUp:

                    mLookUp      = new RepositoryItemLookUpEdit();
                    mLookUp.Name = "LOOKUP_" + gc.FieldName;
                    //mLookUp.Properties.SearchMode  = DevExpress.XtraEditors.Controls.SearchMode.AutoComplete;
                    //mLookUp.Properties.AutoSearchColumnIndex = 0;
                    mLookUp.SearchMode            = DevExpress.XtraEditors.Controls.SearchMode.AutoComplete;
                    mLookUp.AutoSearchColumnIndex = 0;
                    this._GridControl.RepositoryItems.Add(mLookUp);
                    gc.ColumnEdit = mLookUp;
                    //gc.OptionsColumn.ReadOnly  = false;
                    //gc.OptionsColumn.AllowEdit= true;
                    break;

                case _ColumnType.Radio:
                    if (this._GridControl != null)
                    {
                        mRadio = new RepositoryItemRadioGroup();

                        this._GridControl.RepositoryItems.Add(mRadio);
                        gc.ColumnEdit = mRadio;
                        //gc.OptionsColumn.ReadOnly  = false;
                        //gc.OptionsColumn.AllowEdit= true;
                    }
                    break;

                case _ColumnType.RichEdit:
                    if (this._GridControl != null)
                    {
                        mRichEdit = new RepositoryItemRichTextEdit();
                        this._GridControl.RepositoryItems.Add(mRichEdit);
                        gc.ColumnEdit = mRichEdit;
                        //gc.OptionsColumn.ReadOnly  = false;
                        //gc.OptionsColumn.AllowEdit= true;
                    }
                    break;

                case _ColumnType.Button:
                    if (this._GridControl != null)
                    {
                        mBtn = new RepositoryItemButtonEdit();
                        mBtn.TextEditStyle   = DevExpress.XtraEditors.Controls.TextEditStyles.HideTextEditor;
                        mBtn.Buttons[0].Kind = DevExpress.XtraEditors.Controls.ButtonPredefines.Glyph;
                        //mBtn.Properties.Buttons[0].Caption = "확인";
                        mBtn.Properties.Buttons[0].Appearance.ForeColor = Color.Black;
                        this._GridControl.RepositoryItems.Add(mBtn);
                        gc.ColumnEdit = mBtn;
                        //gc.OptionsColumn.ReadOnly  = false;
                        //gc.OptionsColumn.AllowEdit= true;
                    }
                    break;

                case _ColumnType.DataTimepicker:
                    if (this._GridControl != null)
                    {
                        mDateEdit = new RepositoryItemDateEdit();
                        mDateEdit.EditFormat.FormatType      = FormatType.DateTime;
                        mDateEdit.DisplayFormat.FormatString = "yyyy-MM-dd";
                        mDateEdit.Appearance.ForeColor       = Color.Black;
                        this._GridControl.RepositoryItems.Add(mDateEdit);
                        gc.ColumnEdit = mDateEdit;
                        //gc.OptionsColumn.ReadOnly  = false;
                        //gc.OptionsColumn.AllowEdit= true;
                    }
                    break;

                case _ColumnType.Progressbar:
                    if (this._GridControl != null)
                    {
                        mProgressBar                         = new RepositoryItemProgressBar();
                        mProgressBar.ShowTitle               = true;
                        mProgressBar.ProgressViewStyle       = DevExpress.XtraEditors.Controls.ProgressViewStyle.Solid;
                        mProgressBar.PercentView             = true;
                        mProgressBar.ProgressKind            = DevExpress.XtraEditors.Controls.ProgressKind.Horizontal;
                        mProgressBar.NullText                = "0";
                        mProgressBar.Step                    = 1;
                        mProgressBar.EditFormat.FormatType   = FormatType.Numeric;
                        mProgressBar.EditFormat.FormatString = "n2";
                        this._GridControl.RepositoryItems.Add(mProgressBar);
                        gc.ColumnEdit = mProgressBar;
                        //gc.OptionsColumn.ReadOnly  = false;
                        //gc.OptionsColumn.AllowEdit= true;
                    }
                    break;

                default: break;
                }
            }

            return(gc);
        }
Example #3
0
 /// <summary>
 /// 그리드에 컬럼을 추가합니다.
 /// </summary>
 /// <param name="Caption">컬럼캡션</param>
 /// <param name="Field">매핑필드명</param>
 /// <param name="ColumnType">컬럼타입</param>
 /// <param name="Width">컬럼 넒이.</param>
 /// <param name="Align">컬럼높이.</param>
 /// <param name="IsVisble">컬럼화면출력여부 <c>true</c> [is visble].</param>
 /// <param name="IsAllowEdit">컬럼수정가능여부 <c>true</c> [is allow edit].</param>
 /// <param name="IsAllowSort">컬럼소트여부.</param>
 /// <param name="FilterCondition">컬럼의 필터 속성을 지정합니다.</param>
 public void AddColumn(string Caption, string Field, _ColumnType ColumnType, int Width, _ColumnAlign Align, bool IsVisble, bool IsAllowEdit, DefaultBoolean IsAllowSort, AutoFilterCondition FilterCondition, bool IsAllowMove)
 {
     _GridView.Columns.Add(SetColumn(Caption, Field, ColumnType, Width, Align, IsVisble, IsAllowEdit, IsAllowSort, FilterCondition, IsAllowMove));
 }
Example #4
0
 /// <summary>
 /// 그리드에 컬럼을 추가합니다.
 /// </summary>
 /// <param name="Caption">컬럼캡션</param>
 /// <param name="Field">매핑필드명</param>
 /// <param name="ColumnType">컬럼타입</param>
 /// <param name="Width">컬럼 넒이.</param>
 /// <param name="Align">컬럼높이.</param>
 /// <param name="IsVisble">컬럼화면출력여부 <c>true</c> [is visble].</param>
 public void AddColumn(string Caption, string Field, _ColumnType ColumnType, int Width, _ColumnAlign Align, bool IsVisble)
 {
     _GridView.Columns.Add(SetColumn(Caption, Field, ColumnType, Width, Align, IsVisble, false, DefaultBoolean.True, AutoFilterCondition.Default, true));
 }
Example #5
0
        private static void InitializeColumnA(DevExpress.XtraGrid.Views.BandedGrid.AdvBandedGridView view,
                                              string ColumnName,
                                              _ColumnType type,
                                              _ColumnAlign mAlign,
                                              bool IsVisible,
                                              bool IsAllowEdit,
                                              bool IsAllowMove)
        {
            try
            {
                view.Columns[ColumnName].AppearanceHeader.Options.UseTextOptions = true;
                // 셀 텍스트 옵션을 사용한다.
                view.Columns[ColumnName].AppearanceCell.Options.UseTextOptions = true;
                view.Columns[ColumnName].AppearanceCell.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Default;
                view.Columns[ColumnName].AppearanceCell.TextOptions.HAlignment = (DevExpress.Utils.HorzAlignment)mAlign;

                view.Columns[ColumnName].AppearanceHeader.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Default;
                view.Columns[ColumnName].AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;

                view.Columns[ColumnName].Visible = IsVisible;
                if (IsVisible)
                {
                    view.Columns[ColumnName].VisibleIndex = view.Columns.Count;
                }
                else
                {
                    view.Columns[ColumnName].VisibleIndex = -1;
                }

                view.Columns[ColumnName].OptionsColumn.AllowMove = IsAllowMove;
                view.Columns[ColumnName].OptionsColumn.AllowSize = true;
                view.Columns[ColumnName].OptionsColumn.AllowEdit = IsAllowEdit;
                view.Columns[ColumnName].OptionsColumn.ReadOnly  = !IsAllowEdit;



                switch (type)
                {
                case _ColumnType.CheckBox:
                    mCheckBox                = new DevExpress.XtraEditors.Repository.RepositoryItemCheckEdit();
                    mCheckBox.CheckStyle     = DevExpress.XtraEditors.Controls.CheckStyles.Style4;
                    mCheckBox.NullStyle      = DevExpress.XtraEditors.Controls.StyleIndeterminate.Unchecked;
                    mCheckBox.ValueChecked   = "Y";
                    mCheckBox.ValueUnchecked = "N";
                    view.GridControl.RepositoryItems.Add(mCheckBox);
                    view.Columns[ColumnName].ColumnEdit = mCheckBox;
                    break;

                case _ColumnType.CheckBoxBit:
                    mCheckBox                = new DevExpress.XtraEditors.Repository.RepositoryItemCheckEdit();
                    mCheckBox.CheckStyle     = DevExpress.XtraEditors.Controls.CheckStyles.Style4;
                    mCheckBox.NullStyle      = DevExpress.XtraEditors.Controls.StyleIndeterminate.Unchecked;
                    mCheckBox.ValueChecked   = "1";
                    mCheckBox.ValueUnchecked = "0";
                    view.GridControl.RepositoryItems.Add(mCheckBox);
                    view.Columns[ColumnName].ColumnEdit = mCheckBox;
                    break;

                case _ColumnType.Picture:
                    mPicture          = new RepositoryItemPictureEdit();
                    mPicture.SizeMode = DevExpress.XtraEditors.Controls.PictureSizeMode.Stretch;
                    view.GridControl.RepositoryItems.Add(mPicture);
                    view.Columns[ColumnName].ColumnEdit = mPicture;
                    break;

                case _ColumnType.Numbers:

                    view.Columns[ColumnName].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Numeric;
                    view.Columns[ColumnName].DisplayFormat.FormatString = "n0";
                    break;

                case _ColumnType.Dates:

                    view.Columns[ColumnName].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.DateTime;
                    view.Columns[ColumnName].DisplayFormat.FormatString = "yyyy-MM-dd";
                    break;

                case _ColumnType.DateTime:

                    view.Columns[ColumnName].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.DateTime;
                    view.Columns[ColumnName].DisplayFormat.FormatString = "yyyy-MM-dd HH:mm:ss";

                    break;

                case _ColumnType.ComboBox:
                    mComboBox = new RepositoryItemComboBox();
                    mComboBox.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
                    view.GridControl.RepositoryItems.Add(mComboBox);
                    view.Columns[ColumnName].ColumnEdit = mComboBox;
                    break;

                case _ColumnType.doubles1:

                    view.Columns[ColumnName].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Numeric;
                    view.Columns[ColumnName].DisplayFormat.FormatString = "n1";
                    break;

                case _ColumnType.doubles2:

                    view.Columns[ColumnName].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Numeric;
                    view.Columns[ColumnName].DisplayFormat.FormatString = "n2";
                    break;

                case _ColumnType.TextEdit:
                    mTextEdit = new RepositoryItemTextEdit();
                    view.GridControl.RepositoryItems.Add(mTextEdit);
                    view.Columns[ColumnName].ColumnEdit = mTextEdit;

                    break;

                case _ColumnType.Amount:

                    view.Columns[ColumnName].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Numeric;
                    view.Columns[ColumnName].DisplayFormat.FormatString = "###,###";
                    break;

                case _ColumnType.Radio:
                    mRadio = new RepositoryItemRadioGroup();
                    view.GridControl.RepositoryItems.Add(mRadio);
                    view.Columns[ColumnName].ColumnEdit = mRadio;
                    break;

                case _ColumnType.LookUp:
                    mLookUp      = new DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit();
                    mLookUp.Name = "LOOKUP_" + view.Columns[ColumnName].Name;
                    //mLookUp.Properties.SearchMode = DevExpress.XtraEditors.Controls.SearchMode.AutoComplete;
                    //mLookUp.Properties.AutoSearchColumnIndex = 0;
                    view.GridControl.RepositoryItems.Add(mLookUp);
                    view.Columns[ColumnName].ColumnEdit = mLookUp;
                    break;

                case _ColumnType.RichEdit:
                    mRichEdit = new RepositoryItemRichTextEdit();
                    view.GridControl.RepositoryItems.Add(mRichEdit);
                    view.Columns[ColumnName].ColumnEdit = mRichEdit;
                    break;

                case _ColumnType.Button:
                    mBtn = new RepositoryItemButtonEdit();
                    mBtn.TextEditStyle   = DevExpress.XtraEditors.Controls.TextEditStyles.HideTextEditor;
                    mBtn.Buttons[0].Kind = DevExpress.XtraEditors.Controls.ButtonPredefines.Glyph;
                    //mBtn.Properties.Buttons[0].Caption = "확인";
                    mBtn.Properties.Buttons[0].Appearance.ForeColor = System.Drawing.Color.Black;
                    view.GridControl.RepositoryItems.Add(mBtn);
                    view.Columns[ColumnName].ColumnEdit = mBtn;
                    break;

                case _ColumnType.DataTimepicker:
                    if (view.GridControl != null)
                    {
                        mDateEdit = new RepositoryItemDateEdit();
                        mDateEdit.EditFormat.FormatType      = FormatType.DateTime;
                        mDateEdit.DisplayFormat.FormatString = "yyyy-MM-dd";

                        mDateEdit.Appearance.ForeColor = Color.Black;
                        view.GridControl.RepositoryItems.Add(mDateEdit);
                        view.Columns[ColumnName].ColumnEdit = mDateEdit;
                        //gc.OptionsColumn.ReadOnly  = false;
                        //gc.OptionsColumn.AllowEdit= true;
                    }
                    break;

                default: break;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }