private void CustomizatonForm_Load(object sender, EventArgs e) { // base.OnLoad(e); LayoutControlItem lci = layoutControl1.GetItemByControl(bpCustomButtons); ButtonsPanel oldPanel = lci.Control as ButtonsPanel; MyButtonsPanel newPanel = new MyButtonsPanel(); oldPanel.UnRegister(); lci.BeginInit(); lci.Control = newPanel; newPanel.Parent = oldPanel.Parent; oldPanel.Parent = null; lci.EndInit(); newPanel.Register(); lci.Update(); //Copy events from one control to another //var eventsField = typeof(Component).GetField("events", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); //var eventHandlerList = eventsField.GetValue(oldPanel.UndoButton); //eventsField.SetValue(simpleButton1, eventHandlerList); this.Size = new Size(655, 365); this.Location = System.Windows.Forms.Cursor.Position; ddlUser.EditValue = BL.ApplicationDataContext.Instance.LoggedInUser.Id; BindingSourceUsers.DataSource = DataContext.ReadonlyContext.VW_User.Where(n => n.Archived == false).ToList(); cbeUsers.Properties.ForceUpdateEditValue = DevExpress.Utils.DefaultBoolean.True; cbeUsers.EditValue = BL.ApplicationDataContext.Instance.LoggedInUser.Id.ToString(); cbeUsers.RefreshEditValue(); }
private void UpdateOperatorComboBox() { // Lấy thông tin Field được chọn var field = m_Condition.EditValue as ModuleFieldInfo; // Lấy các phép toán tương ứng với FieldType if (field != null) { var opField = FieldUtils.GetModuleFieldByID( ParentModule.ModuleInfo.ModuleType, field.ConditionType); m_ConditionGroupLayout.BeginUpdate(); m_EditValueLayoutItem.BeginInit(); if (m_Operator != null) { m_OperatorLayoutItem.Control = null; m_Operator.Parent = null; } m_Operator = (ImageComboBoxEdit)ParentModule.CreateControl(opField); ParentModule.SetControlListSource(m_Operator); } m_OperatorLayoutItem.Control = m_Operator; m_OperatorLayoutItem.TextVisible = false; m_OperatorLayoutItem.SizeConstraintsType = SizeConstraintsType.Custom; m_OperatorLayoutItem.MinSize = m_OperatorLayoutItem.MaxSize = new Size(180, 1); m_EditValueLayoutItem.EndInit(); m_ConditionGroupLayout.EndUpdate(); ParentModule.SetControlDefaultValue(m_Operator); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); LayoutControlItem lci = layoutControl1.GetItemByControl(buttonsPanel1); ButtonsPanel oldPanel = lci.Control as ButtonsPanel; MyButtonsPanel newPanel = new MyButtonsPanel(); oldPanel.UnRegister(); lci.BeginInit(); lci.Control = newPanel; newPanel.Parent = oldPanel.Parent; oldPanel.Parent = null; lci.EndInit(); newPanel.Register(); lci.Update(); }
/// <summary> /// Initializes a new instance of the <see cref="ElasticLookupControlTemplate" /> class. /// </summary> public ElasticLookupControlTemplate() : base() { typeAndFindPanel.SuspendLayout(); typeAndFindPanel.Root.BeginInit(); typeAndFindPanel.Root.Remove(searchActionContainerLayoutItem); typeAndFindPanel.Root.Remove(typeValueLayoutItem); typeAndFindPanel.Height += 5; elasticActionContainerLayoutGroup = new LayoutControlGroup(); elasticActionContainerLayoutItem = new LayoutControlItem(); elasticActionContainer = new ButtonsContainer(); elasticActionContainerLayoutGroup.BeginInit(); elasticActionContainerLayoutItem.BeginInit(); elasticActionContainer.BeginInit(); elasticActionContainerLayoutGroup.TextVisible = false; elasticActionContainerLayoutGroup.GroupBordersVisible = false; elasticActionContainerLayoutGroup.DefaultLayoutType = LayoutType.Horizontal; elasticActionContainerLayoutItem.Control = elasticActionContainer; elasticActionContainerLayoutItem.Padding = new Padding(0); elasticActionContainerLayoutItem.Name = nameof(elasticActionContainerLayoutItem); elasticActionContainerLayoutItem.TextVisible = false; elasticActionContainerLayoutItem.ControlAlignment = ContentAlignment.MiddleRight; elasticActionContainer.AllowCustomization = false; elasticActionContainer.ContainerId = "ElasticActionContainer"; elasticActionContainer.Name = nameof(elasticActionContainer); elasticActionContainer.HideItemsCompletely = false; elasticActionContainer.Dock = System.Windows.Forms.DockStyle.Fill; elasticActionContainer.PaintStyle = ActionItemPaintStyle.Caption; elasticActionContainer.Root.DefaultLayoutType = LayoutType.Horizontal; elasticActionContainer.Root.EnableIndentsWithoutBorders = DefaultBoolean.True; elasticActionContainer.Root.GroupBordersVisible = false; elasticActionContainer.Root.Location = new Point(0, 0); elasticActionContainer.Root.Name = "elasticActionContainerLayoutControlGroup"; elasticActionContainer.Root.Padding = new Padding(0, 0, 0, 0); elasticActionContainer.Root.Spacing = new Padding(0, 0, 0, 0); elasticActionContainer.TabStop = false; ActionContainersManager.ActionContainerComponents.Add(elasticActionContainer); elasticActionContainerLayoutGroup.AddItem(typeValueLayoutItem); elasticActionContainerLayoutGroup.AddItem(elasticActionContainerLayoutItem); typeAndFindPanel.Root.AddItem(elasticActionContainerLayoutGroup); typeAndFindPanel.Root.AddItem(searchActionContainerLayoutItem); elasticActionContainer.EndInit(); elasticActionContainerLayoutItem.EndInit(); elasticActionContainerLayoutGroup.EndInit(); typeAndFindPanel.Root.EndInit(); typeAndFindPanel.ResumeLayout(false); }