예제 #1
0
        public override bool Populate(cmnGroupData data)
        {
            if (!base.Populate(data) || data.GetType() != typeof(CMNBtnGroupData))
            {
                return(false);
            }
            CMNBtnGroupData calcBtnGroupData = (CMNBtnGroupData)data;

            if (calcBtnGroupData.mButtons == null || calcBtnGroupData.mButtons.Length == 0)
            {
                return(true);
            }
            this.mButtons = new GroupButton[calcBtnGroupData.mButtons.Length];
            this.mRows    = 0;
            this.mColumns = 0;
            foreach (cmnBtnData mButton in calcBtnGroupData.mButtons)
            {
                if (mButton.mVIndex >= this.mRows)
                {
                    ++this.mRows;
                }
                if (mButton.mHIndex >= this.mColumns)
                {
                    ++this.mColumns;
                }
            }
            if (this.mRows == 0 || this.mColumns == 0)
            {
                return(true);
            }
            this.mHeight = ButtonGroupCtrl.GROUP_TOP_PADDING + this.mRows * (calcBtnGroupData.mBtnSize.Height + ButtonGroupCtrl.BUTTON_V_SPACE) - ButtonGroupCtrl.BUTTON_V_SPACE + ButtonGroupCtrl.GROUP_BOTTOM_PADDING;
            FlatStyle btnStyle = ButtonGroupCtrl.GetBtnStyle();

            for (int index = 0; index < calcBtnGroupData.mButtons.Length; ++index)
            {
                cmnBtnData  data1       = (cmnBtnData)calcBtnGroupData.mButtons.GetValue(index);
                GroupButton groupButton = new GroupButton(data1);
                groupButton.FlatStyle = btnStyle;
                groupButton.ForeColor = Color.FromName(data1.msColor);
                groupButton.Location  = new Point(ButtonGroupCtrl.GROUP_LEFT_PADDING + data1.mHIndex * (calcBtnGroupData.mBtnSize.Width + ButtonGroupCtrl.BUTTON_H_SPACE), ButtonGroupCtrl.GROUP_TOP_PADDING + data1.mVIndex * (calcBtnGroupData.mBtnSize.Height + ButtonGroupCtrl.BUTTON_V_SPACE));
                groupButton.Size      = calcBtnGroupData.mBtnSize;
                groupButton.Name      = data1.msExpression;
                groupButton.TabIndex  = index;
                groupButton.Text      = ResHandler.GetResStringByName(data1.msLabel);
                string msToolTip = data1.msToolTip;
                if (msToolTip != null && !msToolTip.Equals(""))
                {
                    groupButton.ToolTip = ResHandler.GetResStringByName(data1.msToolTip);
                }
                groupButton.Click += new EventHandler(this.OnButton_Click);
                this.mButtons.SetValue((object)groupButton, index);
                this.Controls.Add((Control)groupButton);
            }
            return(true);
        }
예제 #2
0
 public GroupControl(GroupsPane parent)
 {
     this.mTitleBtnList = new ArrayList();
     this.mParent       = parent;
     if (CMNApplication.Theme != null)
     {
         GroupControl.GROUP_HEADER_COLOR      = CMNApplication.Theme.GroupHeaderBack;
         GroupControl.GROUP_HEADER_TEXT_COLOR = CMNApplication.Theme.GroupHeaderText;
     }
     this.InitializeComponent();
     this.msMemoryString = ResHandler.GetResStringByName("#memory");
 }
예제 #3
0
 public bool UpdateGroupMenu()
 {
     if (this.mbtnExpand.ContextMenu == null)
     {
         this.mbtnExpand.ContextMenu = new ContextMenu();
     }
     this.mbtnExpand.ContextMenu.MenuItems.Clear();
     foreach (GroupControl group in this.mGroupPane.Groups)
     {
         System.Windows.Forms.MenuItem menuItem = new System.Windows.Forms.MenuItem(ResHandler.GetResStringByName(group.Data.msGroupName));
         menuItem.Click  += new EventHandler(this.HandleGroupSelection);
         menuItem.Checked = !group.Hidden;
         this.mbtnExpand.ContextMenu.MenuItems.Add(menuItem);
     }
     return(true);
 }