Example #1
0
        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();
        }
Example #2
0
        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();
        }