private void Write9_AcCalcBtnData(string n, string ns, cmnBtnData o, bool isNullable, bool needType)
 {
     if (o == null)
     {
         if (isNullable)
         {
             base.WriteNullTagLiteral(n, ns);
         }
         return;
     }
     if (!needType && o.GetType() != typeof(cmnBtnData))
     {
         throw base.CreateUnknownTypeException(o);
     }
     base.WriteStartElement(n, ns, o);
     if (needType)
     {
         base.WriteXsiType("AcCalcBtnData", "");
     }
     base.WriteAttribute("Label", "", o.msLabel);
     base.WriteAttribute("Action", "", this.Write10_Action(o.msAction));
     base.WriteAttribute("Expression", "", o.msExpression);
     base.WriteAttribute("ExpressionType", "", this.Write11_ExpressionType(o.msExpressionType));
     base.WriteAttribute("HIndex", "", XmlConvert.ToString(o.mHIndex));
     base.WriteAttribute("VIndex", "", XmlConvert.ToString(o.mVIndex));
     base.WriteAttribute("Color", "", o.msColor);
     base.WriteAttribute("ToolTip", "", o.msToolTip);
     base.WriteEndElement(o);
 }
Beispiel #2
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);
        }