示例#1
0
        /// <summary>层复制
        /// 层复制
        /// </summary>
        /// <returns></returns>
        public CLayer Clone()
        {
            CLayer obj = (CLayer)this.MemberwiseClone();

            obj.ListCell = new List <CLayerCell>();
            foreach (CLayerCell nCell in ListCell)
            {
                obj.ListCell.Add(nCell.Clone());
            }
            return(obj);
        }
示例#2
0
        /// <summary>保存
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void toolSave_Click(object sender, EventArgs e)
        {
            CLayer nLay = GetControlInfo();

            if (nLay != null)
            {
                LayerMod = nLay.Clone();
                LayerMod.SaveToDefault();
                bSave            = false;
                toolSave.Enabled = bSave;
            }
        }
示例#3
0
 public frmControlManager(CLayer _LayerMod)
 {
     InitializeComponent();
     LayerMod = _LayerMod;
 }
示例#4
0
        private CLayer GetControlInfo()
        {
            CLayer nLay = new CLayer();

            nLay = LayerMod.Clone();
            nLay.Clear();
            try
            {
                for (int i = 0; i < nLay.ListCell.Count; i++)
                {
                    switch (nLay.ListCell[i].ValueType.ToUpper())
                    {
                    case "STRING":
                        continue;
                        break;

                    case "DATE":
                        string message = "";
                        string sNew    = dGV1.Rows[i].Cells[5].Value.ToString();
                        bool   aa      = nLay.ListCell[i].CheckExcel(sNew, ref message);
                        if (!aa)
                        {
                            MessageBox.Show(message, "错误");
                            return(null);
                        }
                        nLay.ListCell[i].StrValue = message;
                        break;

                    case "INT":
                    case "FLOAT":
                        message = "";
                        sNew    = dGV1.Rows[i].Cells[5].Value.ToString();
                        aa      = nLay.ListCell[i].CheckExcel(sNew, ref message);
                        if (!aa)
                        {
                            MessageBox.Show(message, "错误");
                            return(null);
                        }
                        nLay.ListCell[i].StrValue = sNew;
                        double f1 = Convert.ToDouble(dGV1.Rows[i].Cells[6].Value.ToString());
                        nLay.ListCell[i].RatioValue = dGV1.Rows[i].Cells[6].Value.ToString();
                        break;

                    case "BOOL":
                        string str1 = dGV1.Rows[i].Cells[7].Value.ToString();
                        str1 = str1.Replace(',', ',');
                        str1 = str1.Replace(';', ',');
                        str1 = str1.Replace(':', ',');
                        str1 = str1.Replace(';', ',');
                        str1 = str1.Replace(':', ',');
                        string[] str2 = str1.Split(',');
                        if (str2.Length < 2)
                        {
                            MessageBox.Show("值范围不能少于2个,不同值之间请用','分开", "格式错误");
                            return(null);
                        }
                        nLay.ListCell[i].sRange = str1;

                        message = "";
                        sNew    = dGV1.Rows[i].Cells[5].Value.ToString();
                        aa      = nLay.ListCell[i].CheckExcel(sNew, ref message);
                        if (!aa)
                        {
                            MessageBox.Show(message, "错误");
                            return(null);
                        }
                        nLay.ListCell[i].StrValue = sNew;

                        break;

                    default:
                        break;
                    }
                }
                return(nLay);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "保存失败", MessageBoxButtons.OK);
                return(null);
            }
        }