private void searchLookUpEdit1_Popup(object sender, EventArgs e) { //得到当前SearchLookUpEdit弹出窗体 PopupSearchLookUpEditForm form = (sender as IPopupControl).PopupWindow as PopupSearchLookUpEditForm; SearchEditLookUpPopup popup = form.Controls.OfType <SearchEditLookUpPopup>().FirstOrDefault(); LayoutControl layout = popup.Controls.OfType <LayoutControl>().FirstOrDefault(); //如果窗体内空间没有确认按钮,则自定义确认simplebutton,取消simplebutton,选中结果label if (layout.Controls.OfType <Control>().Where(ct => ct.Name == "btOK").FirstOrDefault() == null) { //得到空的空间 EmptySpaceItem a = layout.Items.Where(it => it.TypeName == "EmptySpaceItem").FirstOrDefault() as EmptySpaceItem; //得到取消按钮,重写点击事件 Control clearBtn = layout.Controls.OfType <Control>().Where(ct => ct.Name == "btClear").FirstOrDefault(); LayoutControlItem clearLCI = (LayoutControlItem)layout.GetItemByControl(clearBtn); clearBtn.Click += clearBtn_Click; //添加一个simplebutton控件(确认按钮) LayoutControlItem myLCI = (LayoutControlItem)clearLCI.Owner.CreateLayoutItem(clearLCI.Parent); myLCI.TextVisible = false; SimpleButton btOK = new SimpleButton() { Name = "btOK", Text = "确定" }; btOK.Click += btOK_Click; myLCI.Control = btOK; myLCI.SizeConstraintsType = SizeConstraintsType.Custom;//控件的大小设置为自定义 myLCI.MaxSize = clearLCI.MaxSize; myLCI.MinSize = clearLCI.MinSize; myLCI.Move(clearLCI, DevExpress.XtraLayout.Utils.InsertType.Left); } }
void CreateGauge() { var modelGauge = Model.NetIncome.Gauge; if (modelGauge.GaugeProviderType != null) { var layoutControl = (LayoutControl)PivotGridListEditor.Control; _pivotGaugeTemplate = (IPivotGaugeTemplate)modelGauge.GaugeProviderType.CreateInstance(Model.NetIncome); var gaugeControl = _pivotGaugeTemplate.GaugeControl; var gaugeControlLayoutItem = PivotLayoutControlItem.Parent.Items.FindByName("GaugeControlLayout"); if (gaugeControlLayoutItem == null && modelGauge.Enabled) { gaugeControl.Name = "Gauge"; var layoutControlItem = new LayoutControlItem(layoutControl, gaugeControl) { Name = "GaugeControlLayout" }; layoutControlItem.Move(PivotLayoutControlItem, modelGauge.InsertType); layoutControlItem.TextVisible = false; LoadLayoutSettings(layoutControl); } else if (gaugeControlLayoutItem != null) { gaugeControlLayoutItem.Visibility = modelGauge.Enabled ? LayoutVisibility.Always : LayoutVisibility.Never; } } }
private void CreateControlItem(string labelName, Control control) { LayoutControlItem item = new LayoutControlItem(); item.Parent = this.Root; item.Name = labelName; item.Control = control; item.Text = labelName; //item2.Move(item1, InsertType.Right); if (this.Items.IndexOf(item) > 0) { item.Move(this.Items[this.Items.IndexOf(item) - 1], InsertType.Right); } }
public override void InitializeResources() { base.InitializeResources(); _rgPlasmaBindingPartner = new RadioGroup { Name = "rgPlasmaBindingPartner" }; _rgPlasmaBindingPartner.Properties.Items.AddRange(new[] { new RadioGroupItem(PlasmaProteinBindingPartner.Albumin, PKSimConstants.UI.Albumin), new RadioGroupItem(PlasmaProteinBindingPartner.Glycoprotein, PKSimConstants.UI.Glycoprotein), new RadioGroupItem(PlasmaProteinBindingPartner.Unknown, PKSimConstants.UI.Unknown) }); _layoutItemBindingMode = new LayoutControlItem { Parent = layoutControl.Root, Control = _rgPlasmaBindingPartner, Text = PKSimConstants.UI.FractionUnboundBindingType.FormatForLabel() }; _layoutItemBindingMode.AdjustControlHeight(UIConstants.Size.RADIO_GROUP_HEIGHT); _layoutItemBindingMode.Move(layoutItemGrid, InsertType.Top); _rgPlasmaBindingPartner.SelectedIndexChanged += (o, e) => OnEvent(bindingPartnerChanged); }
private void CreateProcedureCheckBox(ProcedureBl procedure) { layoutControl1.BeginUpdate(); try { //Create checkbox element CheckEdit checkBox = new CheckEdit(); checkBox.Text = procedure.Name; checkBox.Checked = _item.Record2Procedure.Any(x => x.IdProcedure == procedure.Id); checkBox.Tag = procedure; // Create a layout item and insert checkbox LayoutControlItem layoutItem = new LayoutControlItem(layoutControl1, checkBox); layoutItem.Parent = layoutControlGroup1; layoutItem.Name = "layoutItemProcedure" + procedure.Id; layoutItem.TextVisible = false; layoutItem.Move(emptySpaceItem1, InsertType.Top); } finally { // Unlock and update the layout control. layoutControl1.EndUpdate(); } }
public void AddEvent() { LayoutControl lcMain = _data.FrmMain.Controls.Find("lcMain", true)[0] as LayoutControl; RadioGroup radioEdit1 = new RadioGroup(); object[] itemValues = new object[] { 0, 1 }; string[] itemDescriptions = new string[] { "Theo tháng", "Theo lần phát sinh" }; for (int i = 0; i < itemValues.Length; i++) { radioEdit1.Properties.Items.Add(new RadioGroupItem(itemValues[i], itemDescriptions[i])); } radioEdit1.BackColor = System.Drawing.Color.Transparent; radioEdit1.Properties.Columns = 1; radioEdit1.BorderStyle = BorderStyles.NoBorder; radioEdit1.Name = "radioEdit1"; LayoutControlItem item6 = GetElementByName(lcMain, "InputDate"); item6.TextVisible = false; LayoutControlItem item7 = GetElementByName(lcMain, "KyBKBRTTDB"); item7.TextVisible = false; LayoutControlItem item5 = new LayoutControlItem(lcMain, radioEdit1); item5.Parent = lcMain.Root; item5.Move(item7, InsertType.Left); item6.Move(item5, InsertType.Right); item7.Move(item6, InsertType.Top); item5.TextVisible = false; item5.Width = 120; item5.Height = 48; item5.Name = "radioEdit1"; item5.AppearanceItemCaption.Options.UseBackColor = false; _data.FrmMain.Controls.Add(lcMain); item5 = lcMain.Root.AddItem(); this._data.FrmMain.Load += new EventHandler(Frm_Load); radioEdit1.SelectedIndexChanged += new EventHandler(radioEdit1_SelectedIndexChanged); radioEdit1_SelectedIndexChanged(null, null); SpinEdit sepKy = _data.FrmMain.Controls.Find("KyBKBRTTDB", true)[0] as SpinEdit; DateEdit dtmInputDate = _data.FrmMain.Controls.Find("InputDate", true)[0] as DateEdit; sepKy.EditValueChanged += new EventHandler(sepKy_EditValueChanged); dtmInputDate.EditValueChanged += new EventHandler(dtmInputDate_EditValueChanged); }