示例#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();
        }
示例#2
0
        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);
        }
示例#3
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();
        }
 /// <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);
 }
示例#5
0
        public UISearchGroup(ucModule parentModule, LayoutControlGroup parentLayoutGroup)
        {
            ParentModule      = parentModule;
            ModuleInfo        = parentModule.ModuleInfo;
            ParentLayoutGroup = parentLayoutGroup;
            SearchLayout      = (LayoutControl)parentLayoutGroup.Owner;

            Groups     = new List <UISearchGroup>();
            Conditions = new List <UISearchCondition>();

            LayoutGroup = new LayoutControlGroup();

            SearchLayout.BeginUpdate();
            parentLayoutGroup.BeginUpdate();

            m_EditUse = new CheckEdit();
            // GetFields: ModID = ModuleTypeID, Group = SQL_EXPRESSION
            var fieldSqlLogic =
                FieldUtils.GetModuleFields(
                    ModuleInfo.ModuleType,
                    CODES.DEFMODFLD.FLDGROUP.SQL_EXPRESSION
                    )[0];

            //
            m_SQLLogic = (ImageComboBoxEdit)parentModule.CreateControl(fieldSqlLogic);
            parentModule.SetControlListSource(m_SQLLogic);
            parentModule.SetControlDefaultValue(m_SQLLogic);

            m_AddGroup     = new SimpleButton();
            m_AddCondition = new SimpleButton();
            m_DeleteGroup  = new SimpleButton();

            SearchLayout.Controls.AddRange(new Control[] { m_EditUse, m_SQLLogic, m_AddGroup, m_AddCondition, m_DeleteGroup });

            (m_EditUseLayoutItem = LayoutGroup.AddItem("Use Condition", m_EditUse)).BeginInit();
            (m_MainSeparator = (SimpleSeparator)LayoutGroup.AddItem(new SimpleSeparator(), m_EditUseLayoutItem, InsertType.Bottom)).BeginInit();
            (m_SQLLogicLayoutItem = LayoutGroup.AddItem("Group Type", m_SQLLogic, m_EditUseLayoutItem, InsertType.Right)).BeginInit();
            (m_SQLLogicEmptySpace = (EmptySpaceItem)LayoutGroup.AddItem(new EmptySpaceItem(LayoutGroup), m_SQLLogicLayoutItem, InsertType.Right)).BeginInit();
            (m_DeleteGroupLayoutItem = LayoutGroup.AddItem("Delete Group", m_DeleteGroup, m_SQLLogicEmptySpace, InsertType.Right)).BeginInit();
            (m_AddGroupLayoutItem = LayoutGroup.AddItem("Add Group", m_AddGroup, m_DeleteGroupLayoutItem, InsertType.Right)).BeginInit();
            (m_AddConditionLayoutItem = LayoutGroup.AddItem("Add Condition", m_AddCondition, m_AddGroupLayoutItem, InsertType.Right)).BeginInit();

            // m_chkEditUse
            m_EditUse.Text              = "";
            m_EditUse.Checked           = true;
            m_EditUse.EditValueChanged += CheckEditUse_CheckedChanged;

            // m_btnDeleteGroup
            parentModule.Language.FormatButton(m_DeleteGroup, "btnDeleteGroupCondition");
            m_DeleteGroup.Click += DeleteGroupCondition_Click;

            // m_btnAddGroup
            parentModule.Language.FormatButton(m_AddGroup, "btnAddGroupCondition");
            m_AddGroup.Click += AddGroupCondition_Click;

            // m_btnAddCondition
            parentModule.Language.FormatButton(m_AddCondition, "btnAddCondition");
            m_AddCondition.Click += AddConditionButton_Click;

            // LayoutGroup
            LayoutGroup.Padding      = new DevExpress.XtraLayout.Utils.Padding(9, 2, 2, 2);
            LayoutGroup.TextLocation = DevExpress.Utils.Locations.Left;
            LayoutGroup.Text         = " ";

            // m_layout_chkEditUse
            m_EditUseLayoutItem.TextVisible             = false;
            m_EditUseLayoutItem.SizeConstraintsType     = SizeConstraintsType.Custom;
            m_EditUseLayoutItem.ControlAlignment        = ContentAlignment.MiddleCenter;
            m_EditUseLayoutItem.FillControlToClientArea = false;
            m_EditUseLayoutItem.MinSize     =
                m_EditUseLayoutItem.MaxSize = new Size(20, 24);

            // m_layout_cboSQLLogic
            m_SQLLogicLayoutItem.TextVisible            = false;
            m_SQLLogicLayoutItem.SizeConstraintsType    = SizeConstraintsType.Custom;
            m_SQLLogicLayoutItem.ControlAlignment       = ContentAlignment.MiddleCenter;
            m_EditUseLayoutItem.FillControlToClientArea = false;
            m_SQLLogicLayoutItem.MinSize     =
                m_SQLLogicLayoutItem.MaxSize = new Size(240, 24);

            // m_layout_btnDeleteGroup
            m_DeleteGroupLayoutItem.TextVisible         = false;
            m_DeleteGroupLayoutItem.SizeConstraintsType = SizeConstraintsType.Custom;
            m_DeleteGroupLayoutItem.ControlAlignment    = ContentAlignment.MiddleCenter;
            m_EditUseLayoutItem.FillControlToClientArea = false;
            m_DeleteGroupLayoutItem.MinSize             =
                m_DeleteGroupLayoutItem.MaxSize         = new Size(140, 24);

            // m_layout_cboSQLLogic
            m_AddGroupLayoutItem.TextVisible            = false;
            m_AddGroupLayoutItem.SizeConstraintsType    = SizeConstraintsType.Custom;
            m_AddGroupLayoutItem.ControlAlignment       = ContentAlignment.MiddleCenter;
            m_EditUseLayoutItem.FillControlToClientArea = false;
            m_AddGroupLayoutItem.MinSize     =
                m_AddGroupLayoutItem.MaxSize = new Size(140, 24);

            // m_layout_cboSQLLogic
            m_AddConditionLayoutItem.TextVisible         = false;
            m_AddConditionLayoutItem.SizeConstraintsType = SizeConstraintsType.Custom;
            m_AddConditionLayoutItem.ControlAlignment    = ContentAlignment.MiddleCenter;
            m_EditUseLayoutItem.FillControlToClientArea  = false;
            m_AddConditionLayoutItem.MinSize             =
                m_AddConditionLayoutItem.MaxSize         = new Size(110, 24);

            m_MainSeparator.FillControlToClientArea = false;
            m_MainSeparator.SizeConstraintsType     = SizeConstraintsType.Default;

            m_EditUseLayoutItem.EndInit();
            m_SQLLogicLayoutItem.EndInit();
            m_SQLLogicEmptySpace.EndInit();
            m_DeleteGroupLayoutItem.EndInit();
            m_AddGroupLayoutItem.EndInit();
            m_AddConditionLayoutItem.EndInit();
            m_MainSeparator.EndInit();

            parentLayoutGroup.Add(LayoutGroup);

            if (ConditionModule.ConditionLayoutGroup == parentLayoutGroup)
            {
                parentLayoutGroup.AddItem(new EmptySpaceItem(), LayoutGroup, InsertType.Bottom);
                m_DeleteGroupLayoutItem.Visibility = LayoutVisibility.Never;
            }

            parentLayoutGroup.EndUpdate();
            SearchLayout.EndUpdate();
        }