示例#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 virtual bool Populate(cmnGroupData data)
 {
     if (data == null)
     {
         return(false);
     }
     this.mData         = data;
     this.mTitle        = data.msGroupName;// "Group Name"; //ResHandler.GetResStringByName(data.msGroupName);
     this.mHeight       = 240;
     this.mbIsMinimized = data.mbCollapsed;
     return(true);
 }
 private void Write6_AcCalcGroupData(string n, string ns, cmnGroupData o, bool isNullable, bool needType)
 {
     if (o == null)
     {
         if (isNullable)
         {
             base.WriteNullTagLiteral(n, ns);
         }
         return;
     }
     if (!needType)
     {
         Type type = o.GetType();
         if (type != typeof(cmnGroupData))
         {
             //if (type == typeof(AcCalcVariableGroupData))
             //{
             //    this.Write15_AcCalcVariableGroupData(n, ns, (AcCalcVariableGroupData)o, isNullable, true);
             //    return;
             //}
             //if (type == typeof(AcCalcUnitGroupData))
             //{
             //    this.Write12_AcCalcUnitGroupData(n, ns, (AcCalcUnitGroupData)o, isNullable, true);
             //    return;
             //}
             if (type != typeof(CMNBtnGroupData))
             {
                 throw base.CreateUnknownTypeException(o);
             }
             this.Write5_AcCalcBtnGroupData(n, ns, (CMNBtnGroupData)o, isNullable, true);
             return;
         }
     }
     base.WriteStartElement(n, ns, o);
     if (needType)
     {
         base.WriteXsiType("AcCalcGroupData", "");
     }
     base.WriteAttribute("GroupName", "", o.msGroupName);
     base.WriteAttribute("GroupNumber", "", XmlConvert.ToString(o.miGroupNumber));
     base.WriteAttribute("IsCollapsed", "", XmlConvert.ToString(o.mbCollapsed));
     base.WriteElementStringRaw("Hide", "", XmlConvert.ToString(o.Hide));
     base.WriteEndElement(o);
 }