Exemple #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);
        }
 private void Write5_AcCalcBtnGroupData(string n, string ns, CMNBtnGroupData o, bool isNullable, bool needType)
 {
     if (o == null)
     {
         if (isNullable)
         {
             base.WriteNullTagLiteral(n, ns);
         }
         return;
     }
     if (!needType && o.GetType() != typeof(CMNBtnGroupData))
     {
         throw base.CreateUnknownTypeException(o);
     }
     base.WriteStartElement(n, ns, o);
     if (needType)
     {
         base.WriteXsiType("AcCalcBtnGroupData", "");
     }
     base.WriteAttribute("GroupName", "", o.msGroupName);
     base.WriteAttribute("GroupNumber", "", XmlConvert.ToString(o.miGroupNumber));
     base.WriteAttribute("IsCollapsed", "", XmlConvert.ToString(o.mbCollapsed));
     base.WriteAttribute("ButtonStyle", "", this.Write7_FlatStyle(o.mBtnStyle));
     base.WriteAttribute("MaxHRatio", "", XmlConvert.ToString((double)((double)o.mBtnMaxHRatio)));
     base.WriteElementStringRaw("Hide", "", XmlConvert.ToString(o.Hide));
     this.Write8_Size("ButtonSize", "", o.mBtnSize, false);
     cmnBtnData[] acCalcBtnDataArray = o.mButtons;
     if (acCalcBtnDataArray != null)
     {
         for (int i = 0; i < (int)acCalcBtnDataArray.Length; i++)
         {
             this.Write9_AcCalcBtnData("Button", "", acCalcBtnDataArray[i], false, false);
         }
     }
     base.WriteEndElement(o);
 }