/// <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(); this.multiEditorRowProperties1 = new DevExpress.XtraVerticalGrid.Rows.MultiEditorRowProperties(); this.multiEditorRowProperties2 = new DevExpress.XtraVerticalGrid.Rows.MultiEditorRowProperties(); this.vGridControl1 = new DevExpress.XtraVerticalGrid.VGridControl(); this.customersBindingSource = new System.Windows.Forms.BindingSource(this.components); this.nwindDataSet = new WindowsApplication409.nwindDataSet(); this.rowAddress = new DevExpress.XtraVerticalGrid.Rows.EditorRow(); this.rowCity = new DevExpress.XtraVerticalGrid.Rows.EditorRow(); this.rowCompanyName = new DevExpress.XtraVerticalGrid.Rows.EditorRow(); this.rowContactTitle = new DevExpress.XtraVerticalGrid.Rows.EditorRow(); this.rowContactName = new DevExpress.XtraVerticalGrid.Rows.EditorRow(); this.rowCountry = new DevExpress.XtraVerticalGrid.Rows.EditorRow(); this.rowFax = new DevExpress.XtraVerticalGrid.Rows.EditorRow(); this.multiEditorRow1 = new DevExpress.XtraVerticalGrid.Rows.MultiEditorRow(); this.rowCustomerID = new DevExpress.XtraVerticalGrid.Rows.EditorRow(); this.rowPostalCode = new DevExpress.XtraVerticalGrid.Rows.EditorRow(); this.rowRegion = new DevExpress.XtraVerticalGrid.Rows.EditorRow(); this.simpleButton1 = new DevExpress.XtraEditors.SimpleButton(); this.customersTableAdapter = new WindowsApplication409.nwindDataSetTableAdapters.CustomersTableAdapter(); ((System.ComponentModel.ISupportInitialize)(this.vGridControl1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.customersBindingSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nwindDataSet)).BeginInit(); this.SuspendLayout(); // // multiEditorRowProperties1 // this.multiEditorRowProperties1.Caption = "Company"; this.multiEditorRowProperties1.FieldName = "CompanyName"; // // multiEditorRowProperties2 // this.multiEditorRowProperties2.Caption = "Phone"; this.multiEditorRowProperties2.FieldName = "Phone"; // // vGridControl1 // this.vGridControl1.DataSource = this.customersBindingSource; this.vGridControl1.LayoutStyle = DevExpress.XtraVerticalGrid.LayoutViewStyle.SingleRecordView; this.vGridControl1.Location = new System.Drawing.Point(2, 12); this.vGridControl1.Name = "vGridControl1"; this.vGridControl1.RecordWidth = 127; this.vGridControl1.RowHeaderWidth = 73; this.vGridControl1.Rows.AddRange(new DevExpress.XtraVerticalGrid.Rows.BaseRow[] { this.rowAddress, this.rowContactTitle, this.rowPostalCode }); this.vGridControl1.ShowButtonMode = DevExpress.XtraVerticalGrid.ShowButtonModeEnum.ShowAlways; this.vGridControl1.Size = new System.Drawing.Size(448, 400); this.vGridControl1.TabIndex = 0; // // customersBindingSource // this.customersBindingSource.DataMember = "Customers"; this.customersBindingSource.DataSource = this.nwindDataSet; // // nwindDataSet // this.nwindDataSet.DataSetName = "nwindDataSet"; this.nwindDataSet.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema; // // rowAddress // this.rowAddress.ChildRows.AddRange(new DevExpress.XtraVerticalGrid.Rows.BaseRow[] { this.rowCity }); this.rowAddress.Height = 16; this.rowAddress.Name = "rowAddress"; this.rowAddress.Properties.Caption = "Address"; this.rowAddress.Properties.FieldName = "Address"; // // rowCity // this.rowCity.ChildRows.AddRange(new DevExpress.XtraVerticalGrid.Rows.BaseRow[] { this.rowCompanyName }); this.rowCity.Name = "rowCity"; this.rowCity.Properties.Caption = "City"; this.rowCity.Properties.FieldName = "City"; // // rowCompanyName // this.rowCompanyName.Name = "rowCompanyName"; this.rowCompanyName.Properties.Caption = "CompanyName"; this.rowCompanyName.Properties.FieldName = "CompanyName"; // // rowContactTitle // this.rowContactTitle.ChildRows.AddRange(new DevExpress.XtraVerticalGrid.Rows.BaseRow[] { this.rowContactName, this.rowCountry, this.rowCustomerID }); this.rowContactTitle.Name = "rowContactTitle"; this.rowContactTitle.Properties.Caption = "ContactTitle"; this.rowContactTitle.Properties.FieldName = "ContactTitle"; // // rowContactName // this.rowContactName.Name = "rowContactName"; this.rowContactName.Properties.Caption = "ContactName"; this.rowContactName.Properties.FieldName = "ContactName"; // // rowCountry // this.rowCountry.ChildRows.AddRange(new DevExpress.XtraVerticalGrid.Rows.BaseRow[] { this.rowFax }); this.rowCountry.Name = "rowCountry"; this.rowCountry.Properties.Caption = "Country"; this.rowCountry.Properties.FieldName = "Country"; // // rowFax // this.rowFax.ChildRows.AddRange(new DevExpress.XtraVerticalGrid.Rows.BaseRow[] { this.multiEditorRow1 }); this.rowFax.Name = "rowFax"; this.rowFax.Properties.Caption = "Fax"; this.rowFax.Properties.FieldName = "Fax"; // // multiEditorRow1 // this.multiEditorRow1.Name = "multiEditorRow1"; this.multiEditorRow1.PropertiesCollection.AddRange(new DevExpress.XtraVerticalGrid.Rows.MultiEditorRowProperties[] { this.multiEditorRowProperties1, this.multiEditorRowProperties2 }); // // rowCustomerID // this.rowCustomerID.Name = "rowCustomerID"; this.rowCustomerID.Properties.Caption = "CustomerID"; this.rowCustomerID.Properties.FieldName = "CustomerID"; // // rowPostalCode // this.rowPostalCode.ChildRows.AddRange(new DevExpress.XtraVerticalGrid.Rows.BaseRow[] { this.rowRegion }); this.rowPostalCode.Name = "rowPostalCode"; this.rowPostalCode.Properties.Caption = "PostalCode"; this.rowPostalCode.Properties.FieldName = "PostalCode"; // // rowRegion // this.rowRegion.Name = "rowRegion"; this.rowRegion.Properties.Caption = "Region"; this.rowRegion.Properties.FieldName = "Region"; // // simpleButton1 // this.simpleButton1.Location = new System.Drawing.Point(160, 424); this.simpleButton1.Name = "simpleButton1"; this.simpleButton1.Size = new System.Drawing.Size(75, 23); this.simpleButton1.TabIndex = 1; this.simpleButton1.Text = "FindRow"; this.simpleButton1.Click += new System.EventHandler(this.simpleButton1_Click); // // customersTableAdapter // this.customersTableAdapter.ClearBeforeFill = true; // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(515, 462); this.Controls.Add(this.simpleButton1); this.Controls.Add(this.vGridControl1); this.Name = "Form1"; this.Text = "How to obtain a row object by FieldName in the XtraVerticalGrid"; this.Load += new System.EventHandler(this.Form1_Load); ((System.ComponentModel.ISupportInitialize)(this.vGridControl1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.customersBindingSource)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nwindDataSet)).EndInit(); this.ResumeLayout(false); }
private void FrmPSP_PowerSubstationInfoDialog_Load(object sender, EventArgs e) { if (isselect) this.vGridControl.Enabled = false; if (!IsCreate) { checkEdit1.Visible = false; } IList<PSP_PowerSubstationInfo> list = new List<PSP_PowerSubstationInfo>(); list.Add(Object); this.vGridControl.DataSource = list; this.xtraTabControl1.TabPages[0].Text = this.Text; PowerSubstationLine psl = new PowerSubstationLine(); psl.Flag = flags1; //psl.Type = types1; psl.Type2 = types2; IList<PowerSubstationLine> li = Itop.Client.Common.Services.BaseService.GetList<PowerSubstationLine>("SelectPowerSubstationLineByFlagType2", psl); foreach (PowerSubstationLine pss in li) { BaseRow vrow = new DevExpress.XtraVerticalGrid.Rows.EditorRow(); vrow.Properties.Caption = pss.Title; vrow.Properties.FieldName = pss.ClassType; vrow.Height = 25; vrow.Properties.RowEdit = ItemTextEditS1; vrow.Visible = true; vGridControl.Rows.Add(vrow); } //vGridControl.Rows.Add(); //this.rowS2 = new DevExpress.XtraVerticalGrid.Rows.EditorRow(); ////foreach (PowerSubstationLine pss in li) ////{ ////foreach (BaseRow gc1 in this.vGridControl.Rows) ////{ //// if (gc1.Properties.FieldName.Substring(0, 1) == "S") //// { //// if (gc1.Properties.FieldName == pss.ClassType) //// { //// gc1.Properties.Caption = pss.Title; //// gc1.Index = int.Parse(pss.Type); //// //gc1.VisibleIndex = int.Parse(pss.Type); //// //DevExpress.XtraVerticalGrid.Rows.BaseRow aa = DevExpress.Utils.c; //// gc1.Visible = true; //// } //// } ////} ////} }
/// <summary> /// 切换用户组,刷新组信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void listBoxUserGroups_SelectedIndexChanged(object sender, EventArgs e) { if (listBoxUserGroups.SelectedItem == null) { return; } List <string> colNames = new List <string>(); colNames.Add("属性"); colNames.Add("值"); List <string> PropertyNames = new List <string>(); PropertyNames.Add("组名称"); PropertyNames.Add("IP范围"); PropertyNames.Add("模块列表"); PropertyNames.Add("检查权限"); List <string> PropertyValues = new List <string>(); foreach (DataRow dtRow in dtUserGroups.Rows) { string groupName = dtRow["GroupName"].ToString(); if (groupName == listBoxUserGroups.SelectedItem.ToString()) { PropertyValues.Add(dtRow["GroupName"].ToString()); PropertyValues.Add(dtRow["IPRanges"].ToString()); PropertyValues.Add(dtRow["AllowApps"].ToString()); PropertyValues.Add(dtRow["Roles"].ToString()); break; } } UserGroup userGroup = GetUserGroupFromGroupName(listBoxUserGroups.SelectedItem.ToString()); //// 设置组属性数据 VGridRows rows = this.vGridControl.Rows; if (rows != null) { rows.Clear(); DevExpress.XtraVerticalGrid.Rows.EditorRow rowTitle = new DevExpress.XtraVerticalGrid.Rows.EditorRow("PropertyTitle"); rows.Add(rowTitle); rowTitle.Properties.Caption = "属性"; rowTitle.Properties.Value = "值"; for (int i = 0; i < PropertyNames.Count; i++) { DevExpress.XtraVerticalGrid.Rows.EditorRow row = new DevExpress.XtraVerticalGrid.Rows.EditorRow(PropertyNames[i]); rows.Add(row); row.Properties.Caption = PropertyNames[i]; if (i == 2 || i == 3) { row.Properties.RowEdit = this.comboBoxEdit; } else { row.Properties.RowEdit = this.textEdit; } if (i < PropertyValues.Count) { row.Properties.Value = PropertyValues[i]; switch (i) { case 1: if (userGroup.nStatus == 2) { row.Properties.Value = userGroup.IPRanges; } else { userGroup.IPRanges = PropertyValues[i]; } break; case 2: if (userGroup.nStatus == 2) { row.Properties.Value = userGroup.AllowApps; } else { userGroup.AllowApps = PropertyValues[i]; } break; case 3: if (userGroup.nStatus == 2) { row.Properties.Value = userGroup.Roles; } else { userGroup.Roles = PropertyValues[i]; } break; } } } } }
private void FrmPSP_PowerSubstationInfoDialog_Load(object sender, EventArgs e) { if (isselect) { this.vGridControl.Enabled = false; } if (!IsCreate) { checkEdit1.Visible = false; } IList <PSP_PowerSubstationInfo> list = new List <PSP_PowerSubstationInfo>(); list.Add(Object); this.vGridControl.DataSource = list; this.xtraTabControl1.TabPages[0].Text = this.Text; PowerSubstationLine psl = new PowerSubstationLine(); psl.Flag = flags1; //psl.Type = types1; psl.Type2 = types2; IList <PowerSubstationLine> li = Itop.Client.Common.Services.BaseService.GetList <PowerSubstationLine>("SelectPowerSubstationLineByFlagType2", psl); foreach (PowerSubstationLine pss in li) { BaseRow vrow = new DevExpress.XtraVerticalGrid.Rows.EditorRow(); vrow.Properties.Caption = pss.Title; vrow.Properties.FieldName = pss.ClassType; vrow.Height = 25; vrow.Properties.RowEdit = ItemTextEditS1; vrow.Visible = true; vGridControl.Rows.Add(vrow); } //vGridControl.Rows.Add(); //this.rowS2 = new DevExpress.XtraVerticalGrid.Rows.EditorRow(); ////foreach (PowerSubstationLine pss in li) ////{ ////foreach (BaseRow gc1 in this.vGridControl.Rows) ////{ //// if (gc1.Properties.FieldName.Substring(0, 1) == "S") //// { //// if (gc1.Properties.FieldName == pss.ClassType) //// { //// gc1.Properties.Caption = pss.Title; //// gc1.Index = int.Parse(pss.Type); //// //gc1.VisibleIndex = int.Parse(pss.Type); //// //DevExpress.XtraVerticalGrid.Rows.BaseRow aa = DevExpress.Utils.c; //// gc1.Visible = true; //// } //// } ////} ////} }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.vGridControl1 = new DevExpress.XtraVerticalGrid.VGridControl(); this.categoryRow1 = new DevExpress.XtraVerticalGrid.Rows.CategoryRow(); this.editorRow1 = new DevExpress.XtraVerticalGrid.Rows.EditorRow(); this.editorRow2 = new DevExpress.XtraVerticalGrid.Rows.EditorRow(); this.categoryRow2 = new DevExpress.XtraVerticalGrid.Rows.CategoryRow(); this.editorRow3 = new DevExpress.XtraVerticalGrid.Rows.EditorRow(); this.editorRow4 = new DevExpress.XtraVerticalGrid.Rows.EditorRow(); this.editorRow5 = new DevExpress.XtraVerticalGrid.Rows.EditorRow(); ((System.ComponentModel.ISupportInitialize)(this.vGridControl1)).BeginInit(); this.SuspendLayout(); // // vGridControl1 // this.vGridControl1.AllowDrop = true; this.vGridControl1.OptionsBehavior.Editable = true; this.vGridControl1.OptionsBehavior.AutoSelectAllInEditor = true; this.vGridControl1.OptionsBehavior.SmartExpand = true; this.vGridControl1.OptionsBehavior.ResizeRowHeaders = true; this.vGridControl1.OptionsBehavior.ResizeHeaderPanel = true; this.vGridControl1.OptionsBehavior.ResizeRowValues = true; this.vGridControl1.OptionsBehavior.DragRowHeaders = true; this.vGridControl1.OptionsBehavior.UseTabKey = true; this.vGridControl1.Dock = System.Windows.Forms.DockStyle.Fill; this.vGridControl1.Location = new System.Drawing.Point(0, 0); this.vGridControl1.Name = "vGridControl1"; this.vGridControl1.Rows.AddRange(new DevExpress.XtraVerticalGrid.Rows.BaseRow[] { this.categoryRow1, this.categoryRow2 }); this.categoryRow1.ChildRows.AddRange(new DevExpress.XtraVerticalGrid.Rows.BaseRow[] { this.editorRow1, this.editorRow2 }); this.categoryRow2.ChildRows.AddRange(new DevExpress.XtraVerticalGrid.Rows.BaseRow[] { this.editorRow3, this.editorRow4, this.editorRow5 }); this.vGridControl1.Size = new System.Drawing.Size(240, 166); this.vGridControl1.TabIndex = 2; this.vGridControl1.Text = "vGridControl1"; this.vGridControl1.EndDragRow += new DevExpress.XtraVerticalGrid.Events.EndDragRowEventHandler(this.vGridControl1_EndDragRow); this.vGridControl1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.vGridControl1_MouseMove); this.vGridControl1.StartDragRow += new DevExpress.XtraVerticalGrid.Events.StartDragRowEventHandler(this.vGridControl1_StartDragRow); this.vGridControl1.CustomDrawRowHeaderCell += new DevExpress.XtraVerticalGrid.Events.CustomDrawRowHeaderCellEventHandler(this.vGridControl1_CustomDrawRowHeaderCell); // // categoryRow1 // this.categoryRow1.Name = "categoryRow1"; // // editorRow1 // this.editorRow1.Name = "editorRow1"; this.editorRow1.Properties.Caption = "1"; // // editorRow2 // this.editorRow2.Name = "editorRow2"; this.editorRow2.Properties.Caption = "2"; // // categoryRow2 // this.categoryRow2.Name = "categoryRow2"; // // editorRow3 // this.editorRow3.Name = "editorRow3"; this.editorRow3.Properties.Caption = "3"; // // editorRow4 // this.editorRow4.Name = "editorRow4"; this.editorRow4.Properties.Caption = "4"; // // editorRow5 // this.editorRow5.Name = "editorRow5"; this.editorRow5.Properties.Caption = "5"; // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(240, 166); this.Controls.Add(this.vGridControl1); this.Name = "Form1"; this.Text = "Form1"; ((System.ComponentModel.ISupportInitialize)(this.vGridControl1)).EndInit(); this.ResumeLayout(false); }