/// <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); }
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; } }