private void TabControl_SelectedPageChanged(object sender, DevExpress.XtraTab.TabPageChangedEventArgs e) { if (e.Page == PageItem && gvItem.Tag == null) { GridColumn gcItem = gvItem.Columns.ColumnByFieldName("F_ItemID"); if (gcItem != null) { DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit btn = new DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit(); gcItem.ColumnEdit = btn; btn.ButtonClick += new DevExpress.XtraEditors.Controls.ButtonPressedEventHandler(ItemBtnClick1); } gvItem.Tag = "1"; DataLib.sysClass.LoadFormatFromDB(gvItem, this.Name, 1); SetFieldType(binItem, gvItem); } FillItem(); }
public void Load_QC(string sDate) { sSelectedDate = sDate; iSamplePercent = ((frmMain)ParantForm).txtQCSamplePecent.Value; if (GV.sAccessTo == "TR") { sDateColumn = "TR_DATECALLED"; } else { sDateColumn = "WR_DATE_OF_PROCESS"; } if (((frmMain)ParantForm).switchQCProcessTable.Value) { sProcessTable = "Company"; } else { sProcessTable = "Contact"; } if (((frmMain)ParantForm).switchQCProcessType.Value) { sProcessType = "Reprocessed"; } else { sProcessType = "Fresh"; } lblProcessDate.Text = " Process Date :" + sDate; lblProcessTable.Text = " Process Table :" + sProcessTable; lblSamplePercent.Text = " Sample Percent :" + iSamplePercent; lblProcessType.Text = " Process Type :" + sProcessType; splitQC.Panel2Collapsed = true; if (GV.sUserType == "QC" || GV.sUserType == "Admin") { gControl.DataSource = null; string sQuery = string.Empty; string sValidContactStatus = string.Empty; if (GV.sAccessTo == "TR") { sValidContactStatus = GV.sTRContactstatusTobeValidated; } else { sValidContactStatus = GV.sWRContactstatusTobeValidated; } string sProcessed = string.Empty; if (sProcessType == "Reprocessed") { sProcessed = " WHERE (SendBack > 0 OR Reprocessed >0) "; } if (sProcessTable == "Contact") { //sQuery = "SELECT T.AgentName,Processed, ROUND(((Pass + Fail)/Processed)*100,2,1) Sampled,ROUND((Pass/Processed)*100,2,1) Pass,ROUND((Fail/Processed)*100,2,1) Fail, SendBack,Reprocessed FROM ("; //sQuery += " SELECT " + GV.sAccessTo + "_AGENT_NAME AgentName,COUNT(*) Processed,"; //sQuery += " COUNT((SELECT 1 FROM " + GV.sQCTable + " QC WHERE QC.RecordID=CM.CONTACT_ID_P AND TABLENAME='Contact' AND QC.ResearchType='" + GV.sAccessTo + "' AND QC.QC_Sample_Status = 1)) Pass,"; //sQuery += " COUNT((SELECT 1 FROM " + GV.sQCTable + " QC WHERE QC.RecordID=CM.CONTACT_ID_P AND TABLENAME='Contact' AND QC.ResearchType='" + GV.sAccessTo + "' AND QC.QC_Sample_Status = 0)) Fail,"; //sQuery += " COUNT((SELECT 1 FROM " + GV.sQCTable + " QC WHERE QC.RecordID=CM.CONTACT_ID_P AND TABLENAME='Contact' AND QC.ResearchType='" + GV.sAccessTo + "' AND QC.QC_STATUS='SendBack')) SendBack,"; //sQuery += " COUNT((SELECT 1 FROM " + GV.sQCTable + " QC WHERE QC.RecordID=CM.CONTACT_ID_P AND TABLENAME='Contact' AND QC.ResearchType='" + GV.sAccessTo + "' AND QC.QC_STATUS='Reprocessed')) Reprocessed"; //sQuery += " FROM " + GV.sContactTable + " CM WHERE cm." + GV.sAccessTo + "_CONTACT_STATUS IN (" + sValidContactStatus + ")"; //sQuery += " AND CAST(CM." + GV.sAccessTo + "_UPDATED_DATE AS DATE) = '" + sDate + "' GROUP BY " + GV.sAccessTo + "_AGENT_NAME)T " + sProcessed + " Order by T.Processed Desc;"; sQuery = "select T.AgentName,Processed, ROUND(((Pass + Fail) / Processed) * 100, 2, 1) Sampled,ROUND((Pass / Processed) * 100, 2, 1) Pass,ROUND((Fail / Processed) * 100, 2, 1) Fail, SendBack, Reprocessed from ("; sQuery += " select cm." + GV.sAccessTo + "_AGENT_NAME agentname, COUNT(*) Processed,"; sQuery += " count(case when QC.QC_Sample_Status = 1 then cm.CONTACT_ID_P end) Pass,"; sQuery += " count(case when QC.QC_Sample_Status = 0 then cm.CONTACT_ID_P end) Fail,"; sQuery += " count(case when QC.QC_STATUS = 'SENDBACK' then cm.CONTACT_ID_P end) SendBack,"; sQuery += " count(case when QC.QC_STATUS = 'Reprocessed' then cm.CONTACT_ID_P end) Reprocessed"; sQuery += " from " + GV.sContactTable + " CM left join (select * from " + GV.sQCTable + " where TableName = 'Contact' AND ResearchType = '" + GV.sAccessTo + "') QC"; sQuery += " on QC.RecordID = CM.CONTACT_ID_P WHERE cm." + GV.sAccessTo + "_CONTACT_STATUS IN (" + sValidContactStatus + ")"; sQuery += " AND CAST(CM." + GV.sAccessTo + "_UPDATED_DATE AS DATE) = '" + sDate + "' GROUP BY cm." + GV.sAccessTo + "_AGENT_NAME )t Order by T.Processed Desc;"; } else { //sQuery = "SELECT T.AgentName,Processed, ROUND(((Pass + Fail)/Processed)*100,2,1) Sampled,ROUND((Pass/Processed)*100,2,1) Pass,ROUND((Fail/Processed)*100,2,1) Fail, SendBack,Reprocessed FROM ("; //sQuery += " SELECT " + GV.sAccessTo + "_AGENTNAME AgentName,COUNT(*) Processed,"; //sQuery += " COUNT((SELECT 1 FROM " + GV.sQCTable + " QC WHERE QC.RecordID=CM.MASTER_ID AND TABLENAME='Company' AND QC.ResearchType='" + GV.sAccessTo + "' AND QC.QC_Sample_Status = 1)) Pass,"; //sQuery += " COUNT((SELECT 1 FROM " + GV.sQCTable + " QC WHERE QC.RecordID=CM.MASTER_ID AND TABLENAME='Company' AND QC.ResearchType='" + GV.sAccessTo + "' AND QC.QC_Sample_Status = 0)) Fail,"; //sQuery += " COUNT((SELECT 1 FROM " + GV.sQCTable + " QC WHERE QC.RecordID=CM.MASTER_ID AND TABLENAME='Company' AND QC.ResearchType='" + GV.sAccessTo + "' AND QC.QC_STATUS='SendBack')) SendBack,"; //sQuery += " COUNT((SELECT 1 FROM " + GV.sQCTable + " QC WHERE QC.RecordID=CM.MASTER_ID AND TABLENAME='Company' AND QC.ResearchType='" + GV.sAccessTo + "' AND QC.QC_STATUS='Reprocessed')) Reprocessed"; //sQuery += " FROM " + GV.sCompanyTable + " CM WHERE "; //sQuery += " CAST(CM." + sDateColumn + " AS DATE) = '" + sDate + "' GROUP BY " + GV.sAccessTo + "_AGENTNAME)T " + sProcessed + " Order by T.Processed Desc;"; sQuery = "select T.AgentName,Processed, ROUND(((Pass + Fail) / Processed) * 100, 2, 1) Sampled,ROUND((Pass / Processed) * 100, 2, 1) Pass,ROUND((Fail / Processed) * 100, 2, 1) Fail, SendBack, Reprocessed from ("; sQuery += " select cm." + GV.sAccessTo + "_AGENT_NAME agentname, COUNT(*) Processed,"; sQuery += " count(case when QC.QC_Sample_Status = 1 then cm.CONTACT_ID_P end) Pass,"; sQuery += " count(case when QC.QC_Sample_Status = 0 then cm.CONTACT_ID_P end) Fail,"; sQuery += " count(case when QC.QC_STATUS = 'SENDBACK' then cm.CONTACT_ID_P end) SendBack,"; sQuery += " count(case when QC.QC_STATUS = 'Reprocessed' then cm.CONTACT_ID_P end) Reprocessed"; sQuery += " from " + GV.sContactTable + " CM left join (select * from " + GV.sQCTable + " where TableName = 'Contact' AND ResearchType = '" + GV.sAccessTo + "') QC"; sQuery += " on QC.RecordID = CM.CONTACT_ID_P WHERE "; sQuery += " CAST(CM." + sDateColumn + " AS DATE) = '" + sDate + "' GROUP BY cm." + GV.sAccessTo + "_AGENT_NAME )t Order by T.Processed Desc;"; } dtQCTable = GV.MSSQL1.BAL_ExecuteQuery(sQuery); if (dtQCTable.Rows.Count > 0) { DataColumn dcEmpImage = new DataColumn("EmpImage", typeof(System.Byte[])); dtQCTable.Columns.Add("Random"); dtQCTable.Columns.Add("GetSample"); dtQCTable.Columns.Add("QCProcessed"); dtQCTable.Columns.Add(dcEmpImage); sQuery = "SELECT UserName , EmployeeImage FROM RM..EmployeeImage A INNER JOIN CH1020BD02.Timesheet.dbo.Users B ON A.EmployeeID = B.EmployeeNo WHERE B.Active = 'Y' AND B.UserName IN (" + GM.ColumnToQString("AgentName", dtQCTable, "String") + ");"; DataTable dtEmpImage = GV.MSSQL1.BAL_ExecuteQuery(sQuery); Byte[] bDummyImg = GM.imgToByte(Properties.Resources.Misc_User_icon__1_); foreach (DataRow drImage in dtEmpImage.Rows) { string sEmpName = drImage["UserName"].ToString().ToUpper(); foreach (DataRow drQCTable in dtQCTable.Rows) { if (drQCTable["AgentName"].ToString().ToUpper() == sEmpName) { drQCTable["EmpImage"] = drImage["EmployeeImage"]; break; } if (drQCTable["EmpImage"] == DBNull.Value) { drQCTable["EmpImage"] = bDummyImg; } } } //System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmQC)); lView = new LayoutView(gControl); gControl.LookAndFeel.SkinName = "Office 2010 Blue"; gControl.LookAndFeel.UseDefaultLookAndFeel = false; lView.OptionsSelection.MultiSelect = false; gControl.MainView = lView; DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit btnItemRandom = new DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit(); btnItemRandom.Name = "btnRandom"; btnItemRandom.Buttons[0].Caption = "Random"; btnItemRandom.Buttons[0].IsLeft = false; btnItemRandom.Buttons[0].Width = 30; btnItemRandom.Buttons[0].Kind = ButtonPredefines.Glyph; btnItemRandom.Buttons[0].Image = Properties.Resources.new_icon; btnItemRandom.TextEditStyle = TextEditStyles.HideTextEditor; // btnItemRandom.AutoHeight = true; btnItemRandom.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Default; btnItemRandom.ButtonClick += new DevExpress.XtraEditors.Controls.ButtonPressedEventHandler(this.btnRandom_ButtonClick); DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit btnItemGetSample = new DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit(); btnItemGetSample.Name = "btnGetSample"; btnItemGetSample.Buttons[0].Caption = "Sampled"; btnItemGetSample.Buttons[0].IsLeft = false; btnItemGetSample.Buttons[0].Width = 30; btnItemGetSample.Buttons[0].Kind = ButtonPredefines.Glyph; btnItemGetSample.Buttons[0].Image = Properties.Resources.contacts_3_icon; btnItemGetSample.TextEditStyle = TextEditStyles.HideTextEditor; //btnItemGetSample.AutoHeight = true; btnItemGetSample.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Default; btnItemGetSample.ButtonClick += new DevExpress.XtraEditors.Controls.ButtonPressedEventHandler(this.btnGetSample_ButtonClick); DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit btnItemQCProcessed = new DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit(); btnItemQCProcessed.Name = "btnQCProcessed"; btnItemQCProcessed.Buttons[0].Caption = "QC Processed"; btnItemQCProcessed.Buttons[0].IsLeft = false; btnItemQCProcessed.Buttons[0].Width = 30; btnItemQCProcessed.Buttons[0].Kind = ButtonPredefines.Glyph; btnItemQCProcessed.Buttons[0].Image = Properties.Resources.folder_icon__1_; btnItemQCProcessed.TextEditStyle = TextEditStyles.HideTextEditor; //btnItemQCProcessed.AutoHeight = true; btnItemQCProcessed.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Default; btnItemQCProcessed.ButtonClick += new DevExpress.XtraEditors.Controls.ButtonPressedEventHandler(this.btnShowProcessed_ButtonClick); lView.OptionsBehavior.AutoPopulateColumns = false; splitQC.Panel1.Controls.Add(gControl); splitQC.Panel1.Controls.Add(panelQCInfo); gControl.Dock = DockStyle.Fill; panelQCInfo.Dock = DockStyle.Top; LayoutViewColumn colAgentName = lView.Columns.AddField("AgentName"); LayoutViewColumn colProcessCount = lView.Columns.AddField("Processed"); LayoutViewColumn colSampled = lView.Columns.AddField("Sampled"); LayoutViewColumn colPass; LayoutViewColumn colFail; if (sProcessType == "Fresh") { colPass = lView.Columns.AddField("Pass"); colFail = lView.Columns.AddField("Fail"); } else { colPass = lView.Columns.AddField("SendBack"); colFail = lView.Columns.AddField("Reprocessed"); } LayoutViewColumn colbtnRandom = lView.Columns.AddField("Random"); LayoutViewColumn colbtnGetSample = lView.Columns.AddField("GetSample"); LayoutViewColumn colbtnQCProcessed = lView.Columns.AddField("QCProcessed"); LayoutViewColumn colPhoto = lView.Columns.AddField("EmpImage"); //colbtnRandom.ShowButtonMode = DevExpress.XtraGrid.Views.Base.ShowButtonModeEnum.ShowAlways; LayoutViewField fieldAgentName = colAgentName.LayoutViewField; LayoutViewField fieldProcessCount = colProcessCount.LayoutViewField; LayoutViewField fieldSampled = colSampled.LayoutViewField; LayoutViewField fieldPass = colPass.LayoutViewField; LayoutViewField fieldFail = colFail.LayoutViewField; LayoutViewField fieldbtnRandom = colbtnRandom.LayoutViewField; LayoutViewField fieldbtnGetSample = colbtnGetSample.LayoutViewField; LayoutViewField fieldbtnQCProcessed = colbtnQCProcessed.LayoutViewField; LayoutViewField fieldEmpPhoto = colPhoto.LayoutViewField; fieldEmpPhoto.SizeConstraintsType = SizeConstraintsType.Custom; //fieldEmpPhoto.MaxSize = new System.Drawing.Size(20, 20); fieldEmpPhoto.MinSize = new System.Drawing.Size(100, 100); fieldEmpPhoto.TextSize = new System.Drawing.Size(0, 0); fieldEmpPhoto.TextToControlDistance = 0; fieldEmpPhoto.TextVisible = false; fieldAgentName.MinSize = new System.Drawing.Size(100, 100); fieldAgentName.TextSize = new System.Drawing.Size(0, 0); fieldAgentName.TextToControlDistance = 0; fieldAgentName.TextVisible = false; colAgentName.AppearanceCell.Font = new System.Drawing.Font(colAgentName.AppearanceCell.Font.FontFamily, 12, FontStyle.Bold); colPhoto.Visible = true; //RepositoryItemPictureEdit riPictureEdit = grid.RepositoryItems.Add("PictureEdit") as RepositoryItemPictureEdit; RepositoryItemPictureEdit riPictureEdit = new RepositoryItemPictureEdit(); riPictureEdit.SizeMode = PictureSizeMode.Zoom; colPhoto.ColumnEdit = riPictureEdit; lView.OptionsView.ShowHeaderPanel = false; lView.OptionsView.ViewMode = LayoutViewMode.MultiColumn; colAgentName.OptionsColumn.AllowFocus = false; colProcessCount.OptionsColumn.AllowFocus = false; colSampled.OptionsColumn.AllowFocus = false; colPass.OptionsColumn.AllowFocus = false; colFail.OptionsColumn.AllowFocus = false; colPhoto.OptionsColumn.AllowFocus = false; colAgentName.OptionsColumn.AllowEdit = false; colProcessCount.OptionsColumn.AllowEdit = false; colSampled.OptionsColumn.AllowEdit = false; colPass.OptionsColumn.AllowEdit = false; colFail.OptionsColumn.AllowEdit = false; colPhoto.OptionsColumn.AllowEdit = false; colAgentName.OptionsFilter.AllowFilter = false; colProcessCount.OptionsFilter.AllowFilter = false; colSampled.OptionsFilter.AllowFilter = false; colPass.OptionsFilter.AllowFilter = false; colFail.OptionsFilter.AllowFilter = false; colbtnRandom.OptionsFilter.AllowFilter = false; colbtnGetSample.OptionsFilter.AllowFilter = false; colbtnQCProcessed.OptionsFilter.AllowFilter = false; colPhoto.OptionsFilter.AllowFilter = false; colAgentName.OptionsColumn.AllowSort = DevExpress.Utils.DefaultBoolean.False; colProcessCount.OptionsColumn.AllowSort = DevExpress.Utils.DefaultBoolean.False; colSampled.OptionsColumn.AllowSort = DevExpress.Utils.DefaultBoolean.False; colPass.OptionsColumn.AllowSort = DevExpress.Utils.DefaultBoolean.False; colFail.OptionsColumn.AllowSort = DevExpress.Utils.DefaultBoolean.False; colbtnRandom.OptionsColumn.AllowSort = DevExpress.Utils.DefaultBoolean.False; colbtnGetSample.OptionsColumn.AllowSort = DevExpress.Utils.DefaultBoolean.False; colbtnQCProcessed.OptionsColumn.AllowSort = DevExpress.Utils.DefaultBoolean.False; colPhoto.OptionsColumn.AllowSort = DevExpress.Utils.DefaultBoolean.False; colAgentName.OptionsColumn.ReadOnly = true; colProcessCount.OptionsColumn.ReadOnly = true; colSampled.OptionsColumn.ReadOnly = true; colPass.OptionsColumn.ReadOnly = true; colFail.OptionsColumn.ReadOnly = true; colbtnRandom.OptionsColumn.ReadOnly = true; colbtnGetSample.OptionsColumn.ReadOnly = true; colbtnQCProcessed.OptionsColumn.ReadOnly = true; colPhoto.OptionsColumn.ReadOnly = true; colbtnRandom.ColumnEdit = btnItemRandom; colbtnGetSample.ColumnEdit = btnItemGetSample; colbtnQCProcessed.ColumnEdit = btnItemQCProcessed; DevExpress.XtraGrid.StyleFormatCondition styleFormatCondition1 = new DevExpress.XtraGrid.StyleFormatCondition(); styleFormatCondition1.Appearance.BackColor = Color.RosyBrown; styleFormatCondition1.Appearance.Options.UseBackColor = true; styleFormatCondition1.ApplyToRow = false; styleFormatCondition1.Column = colProcessCount; styleFormatCondition1.Condition = DevExpress.XtraGrid.FormatConditionEnum.Expression; styleFormatCondition1.Expression = "[Processed] > 20"; lView.FormatConditions.AddRange(new DevExpress.XtraGrid.StyleFormatCondition[] { styleFormatCondition1 }); fieldAgentName.Move(new LayoutItemDragController(fieldAgentName, fieldEmpPhoto, InsertLocation.After, LayoutType.Horizontal)); LayoutControlGroup groupAgentInfo = lView.TemplateCard.AddGroup("Agent Info", fieldAgentName, InsertType.Bottom); //groupAddress.Add(colPhoto.LayoutViewField); //groupAddress.Add(colAgentName.LayoutViewField); groupAgentInfo.Add(colProcessCount.LayoutViewField); groupAgentInfo.Add(colSampled.LayoutViewField); groupAgentInfo.Add(colPass.LayoutViewField); groupAgentInfo.Add(colFail.LayoutViewField); groupAgentInfo.Add(colbtnRandom.LayoutViewField); groupAgentInfo.Add(colbtnGetSample.LayoutViewField); groupAgentInfo.Add(colbtnQCProcessed.LayoutViewField); //LayoutControlGroup groupRecords = lView.TemplateCard.AddGroup("Record", groupAgentInfo, InsertType.Bottom); //groupRecords.Add(colbtnRandom.LayoutViewField); //groupRecords.Add(colbtnGetSample.LayoutViewField); //groupRecords.Add(colbtnQCProcessed.LayoutViewField); colAgentName.Caption = "Agent Name"; colProcessCount.Caption = "Total Processed"; colSampled.Caption = "Sampled %"; if (sProcessType == "Fresh") { colPass.Caption = "Pass %"; colFail.Caption = "Fail %"; } else { colPass.Caption = "Send Back"; colFail.Caption = "Reprocessed"; } colbtnRandom.Caption = "Get a Random Record"; colbtnGetSample.Caption = "Get " + iSamplePercent + "% sample"; colbtnQCProcessed.Caption = "Show Sampled Records"; //lView.Items[9].TextVisible = false; lView.CardMinSize = new Size(60, 250); gControl.DataSource = dtQCTable; } else { gControl.DataSource = null; } dgvQCList.BackgroundColor = GV.pnlGlobalColor.Style.BackColor2.Color; } }
/// <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; } }
private void InitializeComponent() { DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject1 = new DevExpress.Utils.SerializableAppearanceObject(); this.layoutControl1 = new DevExpress.XtraLayout.LayoutControl(); this.simpleButtonCancel = new DevExpress.XtraEditors.SimpleButton(); this.simpleButtonSave = new DevExpress.XtraEditors.SimpleButton(); this.gridControlHistory = new DevExpress.XtraGrid.GridControl(); this.gridViewHistory = new DevExpress.XtraGrid.Views.Grid.GridView(); this.gridColumnId = new DevExpress.XtraGrid.Columns.GridColumn(); this.gridColumnComment = new DevExpress.XtraGrid.Columns.GridColumn(); this.repositoryItemMemoEdit1 = new DevExpress.XtraEditors.Repository.RepositoryItemMemoEdit(); this.repositoryItemMemoEdit2 = new DevExpress.XtraEditors.Repository.RepositoryItemMemoEdit(); this.gridColumnCreationDate = new DevExpress.XtraGrid.Columns.GridColumn(); this.gridColumnUser = new DevExpress.XtraGrid.Columns.GridColumn(); this.gridColumnCustomerContact = new DevExpress.XtraGrid.Columns.GridColumn(); this.gridColumnDelete = new DevExpress.XtraGrid.Columns.GridColumn(); this.repositoryItemButtonEdit1 = new DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit(); this.repositoryItemButtonEdit2 = new DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit(); this.memoEdit1 = new DevExpress.XtraEditors.MemoEdit(); this.layoutControlGroupQuestion1 = new DevExpress.XtraLayout.LayoutControlGroup(); this.layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem(); this.layoutControlItem3 = new DevExpress.XtraLayout.LayoutControlItem(); this.layoutControlItem4 = new DevExpress.XtraLayout.LayoutControlItem(); this.layoutControlItem2 = new DevExpress.XtraLayout.LayoutControlItem(); this.layoutControlItemHeader = new DevExpress.XtraLayout.LayoutControlItem(); this.layoutControlItemHeader.Name = "layoutControlItemHeader"+Guid.NewGuid().ToString(); this.layoutControlItemPrefix = new DevExpress.XtraLayout.LayoutControlItem(); this.emptySpaceItem1 = new DevExpress.XtraLayout.EmptySpaceItem(); // // layoutControlGroupQuestion1 // this.layoutControlGroupQuestion1.CustomizationFormText = "Root"; this.layoutControlGroupQuestion1.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.True; this.layoutControlGroupQuestion1.AppearanceGroup.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold); this.layoutControlGroupQuestion1.AppearanceGroup.GradientMode = System.Drawing.Drawing2D.LinearGradientMode.Vertical; this.layoutControlGroupQuestion1.AppearanceGroup.Options.UseFont = true; this.layoutControlGroupQuestion1.ExpandButtonVisible = false; this.layoutControlGroupQuestion1.GroupBordersVisible = true; this.layoutControlGroupQuestion1.TextVisible = false; //this.layoutControlGroupQuestion1.Location = new System.Drawing.Point(0, 0); this.layoutControlGroupQuestion1.Padding = new DevExpress.XtraLayout.Utils.Padding(1, 1, 1, 1); this.layoutControlGroupQuestion1.ShowInCustomizationForm = false; //this.layoutControlGroupQuestion1.Text = oSettings.Label + " " + oSettings.QuestionText; this.layoutControlGroupQuestion1.BeginUpdate(); #region Prefix lprefix = new Label(); lprefix.Name = "lprefix"; lprefix.Text = ""; lprefix.Visible = false; this.layoutControlItemPrefix.Location = new System.Drawing.Point(0, 0); this.layoutControlItemPrefix.Name = "layoutControlItemPrefix1"; this.layoutControlItemPrefix.Control = lprefix; this.layoutControlItemPrefix.ShowInCustomizationForm = false; this.layoutControlItemPrefix.TextVisible = false; this.layoutControlItemPrefix.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0); this.layoutControlItemPrefix.MinSize = new Size(0, 10); this.layoutControlItemPrefix.MaxSize = new Size(0, 10); this.layoutControlItemPrefix.SizeConstraintsType = SizeConstraintsType.Custom; this.layoutControlItemPrefix.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; #endregion #region Footer //bool isCustomerOwned = false; //bool isBrightvisionOwned = false; //if (oSettings.CustomerOwnership && oSettings.BVOwnership) // isCustomerOwnershipOnly = true; //ctlFooter = new Footer() { // IsAccountLevel = oSettings.DataBindings.account_level, // IsCustomerOwnershipOnly = isCustomerOwnershipOnly, // HelpText = oSettings.QuestionHelp, // LanguageCode = oSettings.DataBindings.language_code //}; Settings oSettings = Questionnaire.Form.Settings; ctlFooter = new Footer() { IsAccountLevel = oSettings.DataBindings.account_level, IsCustomerOwned = oSettings.CustomerOwnership, IsBrightvisionOwned = oSettings.BVOwnership, HelpText = oSettings.QuestionHelp, LanguageCode = oSettings.DataBindings.language_code, QuestionText = oSettings.Label + " " + oSettings.QuestionText }; ctlFooter.InitializeFooter(); ctlFooter.Dock = DockStyle.Fill; ctlFooter.Height = 20; this.layoutControlItemHeader.Control = ctlFooter; this.layoutControlItemHeader.ShowInCustomizationForm = false; this.layoutControlItemHeader.TextVisible = false; this.layoutControlItemHeader.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0); this.layoutControlItemHeader.MinSize = new Size(0, 24); this.layoutControlItemHeader.MaxSize = new Size(0, 24); this.layoutControlItemHeader.Click += new EventHandler(layoutControlGroupQuestion1_Click); this.layoutControlItemHeader.SizeConstraintsType = SizeConstraintsType.Default; #endregion // // layoutControl1 // this.layoutControl1.Controls.Add(this.ctlFooter); this.layoutControl1.Controls.Add(this.simpleButtonCancel); this.layoutControl1.Controls.Add(this.simpleButtonSave); this.layoutControl1.Controls.Add(this.gridControlHistory); this.layoutControl1.Controls.Add(this.memoEdit1); this.layoutControl1.Dock = System.Windows.Forms.DockStyle.Fill; this.layoutControl1.Location = new System.Drawing.Point(0, 0); this.layoutControl1.Name = "layoutControl1"; this.layoutControl1.Root = this.layoutControlGroupQuestion1; //this.layoutControl1.Size = new System.Drawing.Size(539, 216); this.layoutControl1.TabIndex = 2; this.layoutControl1.Text = "layoutControl1"; // // simpleButtonCancel // this.simpleButtonCancel.Image = global::BrightVision.DQControl.Properties.Resources.cancel_16x16; this.simpleButtonCancel.Location = new System.Drawing.Point(498, 41); this.simpleButtonCancel.Margin = new System.Windows.Forms.Padding(1); this.simpleButtonCancel.Name = "simpleButtonCancel"; this.simpleButtonCancel.MinimumSize = new System.Drawing.Size(22, 22); this.simpleButtonCancel.MaximumSize = new System.Drawing.Size(22, 22); this.simpleButtonCancel.ImageLocation = ImageLocation.MiddleCenter; this.simpleButtonCancel.StyleController = this.layoutControl1; this.simpleButtonCancel.TabIndex = 7; this.simpleButtonCancel.ToolTip = "Cancel"; this.simpleButtonCancel.Click += new EventHandler(simpleButtonCancel_Click); // // simpleButtonSave // this.simpleButtonSave.Image = global::BrightVision.DQControl.Properties.Resources.save_16x16; this.simpleButtonSave.Location = new System.Drawing.Point(498, 7); this.simpleButtonSave.Margin = new System.Windows.Forms.Padding(1); this.simpleButtonSave.Name = "simpleButtonSave"; this.simpleButtonSave.MinimumSize = new System.Drawing.Size(22, 22); this.simpleButtonSave.MaximumSize = new System.Drawing.Size(22, 22); this.simpleButtonSave.ImageLocation = ImageLocation.MiddleCenter; this.simpleButtonSave.StyleController = this.layoutControl1; this.simpleButtonSave.TabIndex = 6; this.simpleButtonSave.Click += new EventHandler(simpleButtonSave_Click); this.simpleButtonSave.ToolTip = "Save"; // // gridControl1 // this.gridControlHistory.Location = new System.Drawing.Point(7, 75); this.gridControlHistory.MainView = this.gridViewHistory; this.gridControlHistory.Name = "gridControlHistory"; this.gridControlHistory.RepositoryItems.AddRange(new DevExpress.XtraEditors.Repository.RepositoryItem[] { this.repositoryItemButtonEdit1, this.repositoryItemMemoEdit1, this.repositoryItemMemoEdit2, this.repositoryItemButtonEdit2}); this.gridControlHistory.MinimumSize = new System.Drawing.Size(0, 150); this.gridControlHistory.MaximumSize = new System.Drawing.Size(0, 150); this.gridControlHistory.Size = new Size(0, 150); this.gridControlHistory.TabIndex = 4; this.gridControlHistory.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] { this.gridViewHistory}); // // gridView1 // this.gridViewHistory.Columns.AddRange(new DevExpress.XtraGrid.Columns.GridColumn[] { this.gridColumnId, this.gridColumnComment, this.gridColumnCreationDate, this.gridColumnUser, this.gridColumnCustomerContact, this.gridColumnDelete}); this.gridViewHistory.GridControl = this.gridControlHistory; this.gridViewHistory.Name = "gridViewHistory"; this.gridViewHistory.OptionsSelection.EnableAppearanceFocusedCell = false; this.gridViewHistory.OptionsView.RowAutoHeight = true; this.gridViewHistory.OptionsView.ShowGroupPanel = false; this.gridViewHistory.OptionsBehavior.ReadOnly = true; //this.gridViewHistory.VertScrollVisibility = DevExpress.XtraGrid.Views.Base.ScrollVisibility.Always; this.gridViewHistory.CustomRowCellEdit += new DevExpress.XtraGrid.Views.Grid.CustomRowCellEditEventHandler(gridViewHistory_CustomRowCellEdit); // //gridcolumn id // this.gridColumnId.Caption = "Id"; this.gridColumnId.FieldName = "id"; this.gridColumnId.Name = "gridColumnId"; this.gridColumnId.Visible = false; // // gridColumn1 // this.gridColumnComment.Caption = "Comment"; this.gridColumnComment.ColumnEdit = this.repositoryItemMemoEdit1; this.gridColumnComment.FieldName = "Comment"; this.gridColumnComment.Name = "gridColumnComment"; this.gridColumnComment.Visible = true; this.gridColumnComment.VisibleIndex = 0; this.gridColumnComment.Width = 200; this.gridColumnComment.MaxWidth = 0; this.gridColumnComment.MinWidth = 0; this.gridColumnComment.ColumnEdit.EditValueChanged += new EventHandler(ColumnEdit_EditValueChanged); // // repositoryItemMemoEdit1 // this.repositoryItemMemoEdit1.Name = "repositoryItemMemoEdit1"; this.repositoryItemMemoEdit1.ReadOnly = false; this.repositoryItemMemoEdit2.Name = "repositoryItemMemoEdit2"; this.repositoryItemMemoEdit2.ReadOnly = true; // // gridColumn2 // this.gridColumnCreationDate.Caption = "Date"; this.gridColumnCreationDate.FieldName = "CreationDate"; this.gridColumnCreationDate.Name = "gridColumnCreationDate"; this.gridColumnCreationDate.Visible = true; this.gridColumnCreationDate.VisibleIndex = 1; this.gridColumnCreationDate.Width = 50; this.gridColumnCreationDate.MaxWidth = 0; this.gridColumnCreationDate.MinWidth = 0; this.gridColumnCreationDate.DisplayFormat.FormatType = FormatType.Custom; this.gridColumnCreationDate.DisplayFormat.Format = new DateCustomFormatter(); this.gridColumnCreationDate.DisplayFormat.FormatString = "yyyy-MM-dd HH:mm"; this.gridColumnCreationDate.OptionsColumn.ReadOnly = true; // // gridColumn3 // this.gridColumnUser.Caption = "User"; this.gridColumnUser.FieldName = "User"; this.gridColumnUser.Name = "gridColumnUser"; this.gridColumnUser.Visible = true; this.gridColumnUser.VisibleIndex = 2; this.gridColumnUser.Width = 70; this.gridColumnUser.MaxWidth = 0; this.gridColumnUser.MinWidth = 0; this.gridColumnUser.OptionsColumn.ReadOnly = true; // // gridColumn4 // this.gridColumnCustomerContact.Caption = "Contact"; this.gridColumnCustomerContact.FieldName = "CustomerContact"; this.gridColumnCustomerContact.Name = "gridColumnCustomerContact"; this.gridColumnCustomerContact.Visible = true; this.gridColumnCustomerContact.VisibleIndex = 3; this.gridColumnCustomerContact.Width = 70; this.gridColumnCustomerContact.MaxWidth = 0; this.gridColumnCustomerContact.MinWidth = 0; this.gridColumnCustomerContact.OptionsColumn.ReadOnly = true; // // gridColumn5 // this.gridColumnDelete.Caption = ""; this.gridColumnDelete.ColumnEdit = this.repositoryItemButtonEdit1; this.gridColumnDelete.FieldName = ""; this.gridColumnDelete.MaxWidth = 30; this.gridColumnDelete.Name = "gridColumnDelete"; this.gridColumnDelete.Visible = true; this.gridColumnDelete.VisibleIndex = 4; this.gridColumnDelete.Width = 30; this.gridColumnDelete.OptionsColumn.ReadOnly = true; // // repositoryItemButtonEdit1 // Image img = ((System.Drawing.Image)(global::BrightVision.DQControl.Properties.Resources.cancel_16x16)); var btn = new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Glyph, "", -1, true, true, false, DevExpress.XtraEditors.ImageLocation.MiddleCenter, img, null, null, "Delete"); this.repositoryItemButtonEdit1.Buttons.Add(btn); this.repositoryItemButtonEdit1.Name = "repositoryItemButtonEdit1"; this.repositoryItemButtonEdit1.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.HideTextEditor; //this.repositoryItemButtonEdit1.ButtonClick += new DevExpress.XtraEditors.Controls.ButtonPressedEventHandler(repositoryItemButtonDelete_ButtonClick); this.repositoryItemButtonEdit1.Click += new EventHandler(repositoryItemButtonDelete_Click); //btn.Appearance.Image = img; this.repositoryItemButtonEdit2.Buttons.Add(btn); this.repositoryItemButtonEdit2.Name = "repositoryItemButtonEdit1"; this.repositoryItemButtonEdit2.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.HideTextEditor; this.repositoryItemButtonEdit2.ReadOnly = true; // // memoEdit1 // this.memoEdit1.Location = new System.Drawing.Point(7, 7); this.memoEdit1.Name = "memoEdit1"; //this.memoEdit1.MinimumSize = new Size(100, 52); //this.memoEdit1.MaximumSize = new Size(0,0); this.memoEdit1.StyleController = this.layoutControl1; this.memoEdit1.TabIndex = 8; this.memoEdit1.Properties.ScrollBars = ScrollBars.None; this.memoEdit1.TextChanged += new EventHandler(memoEdit1_TextChanged); // // emptySpaceItem1 // this.emptySpaceItem1.AllowHotTrack = false; this.emptySpaceItem1.CustomizationFormText = "emptySpaceItem1"; this.emptySpaceItem1.Location = new System.Drawing.Point(383, 52); this.emptySpaceItem1.Name = "emptySpaceItem1"; this.emptySpaceItem1.Size = new System.Drawing.Size(22, 212); this.emptySpaceItem1.Text = "emptySpaceItem1"; this.emptySpaceItem1.TextSize = new System.Drawing.Size(0, 0); // //gridControl // this.layoutControlItem1.Control = this.gridControlHistory; this.layoutControlItem1.CustomizationFormText = "layoutControlItem1"; this.layoutControlItem1.Location = new System.Drawing.Point(0, 68); //this.layoutControlItem1.MinSize = new System.Drawing.Size(0, 100); //this.layoutControlItem1.MaxSize = new System.Drawing.Size(0, 200); this.Size = new Size(0, 150); this.layoutControlItem1.Name = "layoutControlItem1"; this.layoutControlItem1.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.SupportHorzAlignment; this.layoutControlItem1.ControlAlignment = ContentAlignment.BottomCenter; //this.layoutControlItem1.Size = new Size(0, 150); this.layoutControlItem1.Text = "layoutControlItem1"; this.layoutControlItem1.TextSize = new System.Drawing.Size(0, 0); this.layoutControlItem1.TextToControlDistance = 0; this.layoutControlItem1.TextVisible = false; // // layoutControlItem3 // this.layoutControlItem3.Control = this.simpleButtonSave; this.layoutControlItem3.CustomizationFormText = "layoutControlItem3"; this.layoutControlItem3.Location = new System.Drawing.Point(491, 0); this.layoutControlItem3.MaxSize = new System.Drawing.Size(22, 22); this.layoutControlItem3.MinSize = new System.Drawing.Size(22, 22); this.layoutControlItem3.Padding = new DevExpress.XtraLayout.Utils.Padding(1); this.layoutControlItem3.Name = "layoutControlItem3"; this.layoutControlItem3.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Default; this.layoutControlItem3.Text = "layoutControlItem3"; this.layoutControlItem3.TextSize = new System.Drawing.Size(0, 0); this.layoutControlItem3.TextToControlDistance = 0; this.layoutControlItem3.TextVisible = false; // // layoutControlItem4 // this.layoutControlItem4.Control = this.simpleButtonCancel; this.layoutControlItem4.CustomizationFormText = "layoutControlItem4"; this.layoutControlItem4.Location = new System.Drawing.Point(491, 34); this.layoutControlItem4.MaxSize = new System.Drawing.Size(22, 102); this.layoutControlItem4.MinSize = new System.Drawing.Size(22, 22); this.layoutControlItem4.Size = new Size(22, 102); this.layoutControlItem4.Padding = new DevExpress.XtraLayout.Utils.Padding(1); this.layoutControlItem4.Name = "layoutControlItem4"; this.layoutControlItem4.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Default; this.layoutControlItem4.Text = "layoutControlItem4"; this.layoutControlItem4.TextSize = new System.Drawing.Size(0, 0); this.layoutControlItem4.TextToControlDistance = 0; this.layoutControlItem4.TextVisible = false; // // layoutControlItem2 // this.layoutControlItem2.Control = this.memoEdit1; this.layoutControlItem2.CustomizationFormText = "layoutControlItem2"; this.layoutControlItem2.Location = new System.Drawing.Point(0, 0); this.layoutControlItem2.Name = "layoutControlItem2"; this.layoutControlItem2.Text = "layoutControlItem2"; this.layoutControlItem2.TextSize = new System.Drawing.Size(0, 0); this.layoutControlItem1.MinSize = new Size(0, 24); this.layoutControlItem1.MaxSize = new Size(0, 24); this.layoutControlItem2.TextToControlDistance = 0; this.layoutControlItem2.TextVisible = false; this.layoutControlItem2.SizeConstraintsType = SizeConstraintsType.SupportHorzAlignment; // // testinglayout // this.layoutControlGroupQuestion1.AddItem(this.layoutControlItemHeader); this.layoutControlGroupQuestion1.AddItem(this.layoutControlItemPrefix); this.layoutControlGroupQuestion1.AddItem(this.layoutControlItem2); this.layoutControlGroupQuestion1.AddItem(this.layoutControlItem3, this.layoutControlItem2, DevExpress.XtraLayout.Utils.InsertType.Right); this.layoutControlGroupQuestion1.AddItem(this.layoutControlItem4, this.layoutControlItem3, DevExpress.XtraLayout.Utils.InsertType.Bottom); this.layoutControlGroupQuestion1.AddItem(this.layoutControlItem1); this.layoutControlGroupQuestion1.Click += new EventHandler(layoutControlGroupQuestion1_Click); this.layoutControlGroupQuestion1.EndUpdate(); }
public static TreeListColumn CotDong(TreeList treeList) { DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit repositoryItemButtonEditDEL = new DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit(); repositoryItemButtonEditDEL.AutoHeight = false; repositoryItemButtonEditDEL.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder; repositoryItemButtonEditDEL.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Delete, "", 10, true, true, false, DevExpress.Utils.HorzAlignment.Center, null, new DevExpress.Utils.KeyShortcut((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Delete)))}); repositoryItemButtonEditDEL.Name = "repositoryItemButtonEditDEL"; repositoryItemButtonEditDEL.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.HideTextEditor; repositoryItemButtonEditDEL.KeyUp += delegate(object sender , KeyEventArgs e) { if (e.KeyData == Keys.Enter) treeList.DeleteNode(treeList.FocusedNode); }; repositoryItemButtonEditDEL.Click += delegate(object sender , EventArgs e) { treeList.DeleteNode(treeList.FocusedNode); }; treeList.RepositoryItems.Add(repositoryItemButtonEditDEL); TreeListColumn CotXoa = treeList.Columns.Add(); CotXoa.AppearanceHeader.Options.UseTextOptions = true; CotXoa.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; CotXoa.AppearanceCell.Options.UseTextOptions = true; CotXoa.AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; CotXoa.Caption = " "; CotXoa.ColumnEdit = repositoryItemButtonEditDEL; CotXoa.Name = "CotXoa"; CotXoa.OptionsColumn.AllowSize = false; CotXoa.OptionsColumn.FixedWidth = true; CotXoa.Visible = true; CotXoa.VisibleIndex = 50; CotXoa.Width = 25; return CotXoa; }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject1 = new DevExpress.Utils.SerializableAppearanceObject(); this.gridControl1 = new DevExpress.XtraGrid.GridControl(); this.dataTable1 = new System.Data.DataTable(); this.dataColumn1 = new System.Data.DataColumn(); this.gridView1 = new DevExpress.XtraGrid.Views.Grid.GridView(); this.gridColumn1 = new DevExpress.XtraGrid.Columns.GridColumn(); this.repositoryItemButtonEdit1 = new DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit(); this.barManager1 = new DevExpress.XtraBars.BarManager(this.components); this.barDockControlTop = new DevExpress.XtraBars.BarDockControl(); this.barDockControlBottom = new DevExpress.XtraBars.BarDockControl(); this.barDockControlLeft = new DevExpress.XtraBars.BarDockControl(); this.barDockControlRight = new DevExpress.XtraBars.BarDockControl(); this.barButtonItem1 = new DevExpress.XtraBars.BarButtonItem(); this.barButtonItem2 = new DevExpress.XtraBars.BarButtonItem(); this.popupMenu1 = new DevExpress.XtraBars.PopupMenu(this.components); this.dataSet1 = new System.Data.DataSet(); ((System.ComponentModel.ISupportInitialize)(this.gridControl1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataTable1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.gridView1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.repositoryItemButtonEdit1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.barManager1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.popupMenu1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataSet1)).BeginInit(); this.SuspendLayout(); // // gridControl1 // this.gridControl1.DataSource = this.dataTable1; this.gridControl1.Dock = System.Windows.Forms.DockStyle.Fill; this.gridControl1.Location = new System.Drawing.Point(0, 0); this.gridControl1.MainView = this.gridView1; this.gridControl1.Name = "gridControl1"; this.gridControl1.RepositoryItems.AddRange(new DevExpress.XtraEditors.Repository.RepositoryItem[] { this.repositoryItemButtonEdit1 }); this.gridControl1.Size = new System.Drawing.Size(408, 210); this.gridControl1.TabIndex = 0; this.gridControl1.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] { this.gridView1 }); // // dataTable1 // this.dataTable1.Columns.AddRange(new System.Data.DataColumn[] { this.dataColumn1 }); this.dataTable1.TableName = "Table1"; // // dataColumn1 // this.dataColumn1.ColumnName = "Column1"; // // gridView1 // this.gridView1.Columns.AddRange(new DevExpress.XtraGrid.Columns.GridColumn[] { this.gridColumn1 }); this.gridView1.GridControl = this.gridControl1; this.gridView1.Name = "gridView1"; // // gridColumn1 // this.gridColumn1.Caption = "gridColumn1"; this.gridColumn1.ColumnEdit = this.repositoryItemButtonEdit1; this.gridColumn1.FieldName = "Column1"; this.gridColumn1.Name = "gridColumn1"; this.gridColumn1.Visible = true; this.gridColumn1.VisibleIndex = 0; // // repositoryItemButtonEdit1 // this.repositoryItemButtonEdit1.AutoHeight = false; this.repositoryItemButtonEdit1.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton(), new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo, "", -1, true, true, false, DevExpress.XtraEditors.ImageLocation.MiddleCenter, null, new DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), serializableAppearanceObject1, "Click to open a context menu", null, null, true) }); this.repositoryItemButtonEdit1.Name = "repositoryItemButtonEdit1"; this.repositoryItemButtonEdit1.ButtonClick += new DevExpress.XtraEditors.Controls.ButtonPressedEventHandler(this.repositoryItemButtonEdit1_ButtonClick); // // barManager1 // this.barManager1.DockControls.Add(this.barDockControlTop); this.barManager1.DockControls.Add(this.barDockControlBottom); this.barManager1.DockControls.Add(this.barDockControlLeft); this.barManager1.DockControls.Add(this.barDockControlRight); this.barManager1.Form = this; this.barManager1.Items.AddRange(new DevExpress.XtraBars.BarItem[] { this.barButtonItem1, this.barButtonItem2 }); this.barManager1.MaxItemId = 2; // // barDockControlTop // this.barDockControlTop.Dock = System.Windows.Forms.DockStyle.Top; this.barDockControlTop.Location = new System.Drawing.Point(0, 0); this.barDockControlTop.Size = new System.Drawing.Size(408, 0); // // barDockControlBottom // this.barDockControlBottom.Dock = System.Windows.Forms.DockStyle.Bottom; this.barDockControlBottom.Location = new System.Drawing.Point(0, 210); this.barDockControlBottom.Size = new System.Drawing.Size(408, 0); // // barDockControlLeft // this.barDockControlLeft.Dock = System.Windows.Forms.DockStyle.Left; this.barDockControlLeft.Location = new System.Drawing.Point(0, 0); this.barDockControlLeft.Size = new System.Drawing.Size(0, 210); // // barDockControlRight // this.barDockControlRight.Dock = System.Windows.Forms.DockStyle.Right; this.barDockControlRight.Location = new System.Drawing.Point(408, 0); this.barDockControlRight.Size = new System.Drawing.Size(0, 210); // // barButtonItem1 // this.barButtonItem1.Caption = "barButtonItem1"; this.barButtonItem1.Id = 0; this.barButtonItem1.Name = "barButtonItem1"; // // barButtonItem2 // this.barButtonItem2.Caption = "barButtonItem2"; this.barButtonItem2.Id = 1; this.barButtonItem2.Name = "barButtonItem2"; // // popupMenu1 // this.popupMenu1.LinksPersistInfo.AddRange(new DevExpress.XtraBars.LinkPersistInfo[] { new DevExpress.XtraBars.LinkPersistInfo(this.barButtonItem1), new DevExpress.XtraBars.LinkPersistInfo(this.barButtonItem2) }); this.popupMenu1.Manager = this.barManager1; this.popupMenu1.Name = "popupMenu1"; // // dataSet1 // this.dataSet1.DataSetName = "NewDataSet"; this.dataSet1.Locale = new System.Globalization.CultureInfo("en-US"); this.dataSet1.Tables.AddRange(new System.Data.DataTable[] { this.dataTable1 }); // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(408, 210); this.Controls.Add(this.gridControl1); this.Controls.Add(this.barDockControlLeft); this.Controls.Add(this.barDockControlRight); this.Controls.Add(this.barDockControlBottom); this.Controls.Add(this.barDockControlTop); this.Name = "Form1"; this.Text = "How to display a context menu when a ButtonEdit\'s button is clicked"; this.Load += new System.EventHandler(this.Form1_Load); ((System.ComponentModel.ISupportInitialize)(this.gridControl1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dataTable1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.gridView1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.repositoryItemButtonEdit1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.barManager1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.popupMenu1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dataSet1)).EndInit(); this.ResumeLayout(false); }
/// <summary> /// 动态创建DataGridViewColumn /// </summary> private void CreateColumns() { m_ListStaticDataFields.Clear(); m_ListDanymicDataFields.Clear(); //添加固定的列 m_ListStaticDataFields.Add("NOOFINPAT"); //病案首页号 m_ListStaticDataFields.Add("TEMPERATURE"); //体温 m_ListStaticDataFields.Add("WAYOFSURVEY"); //测量方式 m_ListStaticDataFields.Add("PULSE"); // m_ListStaticDataFields.Add("HEARTRATE"); // m_ListStaticDataFields.Add("BREATHE"); // m_ListStaticDataFields.Add("PHYSICALCOOLING"); // m_ListStaticDataFields.Add("PHYSICALHOTTING"); // m_ListStaticDataFields.Add("DAYSAFTERSURGERY"); //术后天数 m_ListStaticDataFields.Add("DAYOFHOSPITAL"); //入院天数 //添加动态的列 try { XmlNode nodeElement = xmlDoc.GetElementsByTagName("dataColumns")[0]; XmlNodeList nodeList = nodeElement.ChildNodes; BandedGridColumn col = null; foreach (XmlNode node in nodeList) { col = new BandedGridColumn(); col.Caption = node.InnerText; col.Name = node.Attributes["name"] == null ? "" : node.Attributes["name"].Value; col.Visible = node.Attributes["isShow"] == null || node.Attributes["isShow"].Value == "1" ? true : false; col.FieldName = node.Attributes["datafield"] == null ? "" : node.Attributes["datafield"].Value; //字段绑定 VitalSignInfoEntity obj = new VitalSignInfoEntity(); obj.caption = col.Caption; obj.cellCtlType = (CellControlType)Enum.Parse(typeof(CellControlType), node.Attributes["cellControl"] == null ? "1" : node.Attributes["cellControl"].Value); obj.showForm = node.Attributes["showDlg"] == null ? "" : node.Attributes["showDlg"].Value; obj.datasource = node.Attributes["listItems"] == null ? null : node.Attributes["listItems"].Value; obj.showType = node.Attributes["showtype"] == null ? null : node.Attributes["showtype"].Value; obj.datafield = col.FieldName; col.Tag = obj; //列外观设置 col.OptionsFilter.AllowAutoFilter = false; col.OptionsFilter.AllowFilter = false; col.OptionsFilter.ImmediateUpdateAutoFilter = false; col.OptionsColumn.AllowEdit = true; col.OptionsFilter.AllowAutoFilter = false; col.OptionsFilter.AllowFilter = false; col.OptionsColumn.AllowMove = false; col.OptionsColumn.AllowSort = DefaultBoolean.False; col.OptionsColumn.AllowShowHide = false; if ((col.Tag as VitalSignInfoEntity).cellCtlType == CellControlType.ShowDlg) //需要弹出框编辑 { RepositoryItemButtonEdit m_ButtonEdit = new DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit(); //供【大便次数】编辑的特殊列样式 m_ButtonEdit.Click += new EventHandler(m_ButtonEdit_Click); this.gridControlVitalSigns.RepositoryItems.Add(m_ButtonEdit); col.ColumnEdit = m_ButtonEdit; m_ButtonEdit.ReadOnly = true; m_ButtonEdit.AutoHeight = false; m_ButtonEdit.TextEditStyle = TextEditStyles.Standard; } else if ((col.Tag as VitalSignInfoEntity).cellCtlType == CellControlType.ComboBox) //需要下拉框编辑 { RepositoryItemComboBox m_ComboBoxEdit = new RepositoryItemComboBox(); this.gridControlVitalSigns.RepositoryItems.Add(m_ComboBoxEdit); col.ColumnEdit = m_ComboBoxEdit; string[] items = (col.Tag as VitalSignInfoEntity).datasource == null ? null : (col.Tag as VitalSignInfoEntity).datasource.ToString().Split(';'); if (items != null && items.Length > 0) { foreach (string str in items) { m_ComboBoxEdit.Items.Add(str); } } } if (obj.showType.Equals("0"))//时段数据 { this.gridBand2.Columns.Add(col); col.AppearanceCell.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); } else //天(日)数据 { this.gridBand3.Columns.Add(col); } this.bandedGridView1.Columns.Add(col); if (col.FieldName == TIMESOFSHIT) { m_colIndexTimesOfShit = col.AbsoluteIndex; } col.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; m_ListDanymicDataFields.Add(col.FieldName, obj); } } catch (Exception ex) { throw ex; } }
public static BandedGridColumn CotPLDong(GridControl GridCtrl, BandedGridView Grid, bool isConfirmDelete) { DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit repositoryItemButtonEditDEL = new DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit(); repositoryItemButtonEditDEL.AutoHeight = false; repositoryItemButtonEditDEL.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder; repositoryItemButtonEditDEL.Buttons.Clear(); repositoryItemButtonEditDEL.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Delete, "", 10, true, true, false, DevExpress.Utils.HorzAlignment.Center, null, new DevExpress.Utils.KeyShortcut((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Delete)))}); repositoryItemButtonEditDEL.Name = "repositoryItemButtonEditDEL"; repositoryItemButtonEditDEL.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.HideTextEditor; // repositoryItemButtonEditDEL.KeyUp += delegate(object sender, KeyEventArgs e) // { // if (e.KeyData == Keys.Enter) // Grid.DeleteRow(Grid.FocusedRowHandle); // }; repositoryItemButtonEditDEL.Click += delegate(object sender, EventArgs e) { if (isConfirmDelete) { if (PLMessageBox.ShowConfirmMessage("Bạn có muốn xóa dòng này không ?") == DialogResult.Yes) Grid.DeleteRow(Grid.FocusedRowHandle); } else { Grid.DeleteRow(Grid.FocusedRowHandle); } }; GridCtrl.RepositoryItems.Add(repositoryItemButtonEditDEL); BandedGridColumn CotXoa = new BandedGridColumn(); CotXoa.AppearanceHeader.Options.UseTextOptions = true; CotXoa.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; CotXoa.AppearanceCell.Options.UseTextOptions = true; CotXoa.AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; CotXoa.Caption = " "; CotXoa.ColumnEdit = repositoryItemButtonEditDEL; CotXoa.Name = "CotXoa"; CotXoa.OptionsColumn.AllowSize = false; CotXoa.OptionsColumn.FixedWidth = true; CotXoa.Visible = true; CotXoa.VisibleIndex = 50; CotXoa.Width = 25; GridBand gridBand = new GridBand(); gridBand.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; gridBand.Columns.Add(CotXoa); gridBand.MinWidth = 10; gridBand.Name = "gridBandCotXoa"; gridBand.Caption = " "; gridBand.OptionsBand.AllowSize = false; gridBand.Width = 10; Grid.Bands.Add(gridBand); Grid.Columns.Add(CotXoa); //Grid.Columns.Add(CotXoa); return CotXoa; }