Ejemplo n.º 1
0
        public void LoadFromXML(XmlElement Node)
        {
            try
            {
                //iElementOrder = Convert.ToInt32(CBaseNode.GetAttribute("iElementOrder"));
                //GLayerName = CBaseNode.GetAttribute("GLayerName");
                XmlElement CBaseNode = (XmlElement)(Node.SelectSingleNode("Misc"));
                //Name = CBaseNode.GetAttribute("Name");

                CBaseNode = (XmlElement)(Node.SelectSingleNode("Appearance"));
                TitleText = CBaseNode.GetAttribute("Caption");

                if (CBaseNode.HasAttribute("iSelTeamIndex"))
                {
                    iSelTeamIndex = Convert.ToInt32(CBaseNode.GetAttribute("iSelTeamIndex"));
                }
                if (CBaseNode.HasAttribute("XAxisTitleShow"))
                {
                    XAxisTitle     = CBaseNode.GetAttribute("XAxisTitle");
                    XAxisFormat    = CBaseNode.GetAttribute("XAxisFormat");
                    XAxisTitleShow = Convert.ToBoolean(CBaseNode.GetAttribute("XAxisTitleShow"));
                }
                if (CBaseNode.HasAttribute("LegendFill"))
                {
                    LegendFill    = ColorTranslator.FromHtml(CBaseNode.GetAttribute("LegendFill"));
                    GridColor     = ColorTranslator.FromHtml(CBaseNode.GetAttribute("GridColor"));
                    PaneFill      = ColorTranslator.FromHtml(CBaseNode.GetAttribute("PaneFill"));
                    ChartFill     = ColorTranslator.FromHtml(CBaseNode.GetAttribute("ChartFill"));
                    CurveLineWith = Convert.ToInt32(CBaseNode.GetAttribute("CurveLineWith"));
                }

                ListCurF.Clear();
                foreach (XmlElement node in CBaseNode.ChildNodes)
                {
                    LoadFontFromXML(node);
                }

                CBaseNode = (XmlElement)(Node.SelectSingleNode("Behavior"));

                bXMajorGridVis = Convert.ToBoolean(CBaseNode.GetAttribute("bXMajorGridVis"));
                bYMajorGridVis = Convert.ToBoolean(CBaseNode.GetAttribute("bYMajorGridVis"));

                foreach (XmlElement node in CBaseNode.ChildNodes)
                {
                    CLSTeamCurve nTream = new CLSTeamCurve();
                    nTream.LoadFromXML(node);
                    ListTream.Add(nTream);
                }
                if (ListTream.Count > 0)
                {
                    SelTream = ListTream[0];
                    //DrawChart();
                }
            }
            catch (Exception e)
            {
            }
        }
Ejemplo n.º 2
0
        private void butTeamAdd_Click(object sender, EventArgs e)
        {
            butApply.Enabled = true;
            Button nBut = (Button)sender;

            switch (nBut.Name)
            {
            case "butTeamAdd":
                string str2 = "";
                foreach (CLSTeamCurve nTeam in ZedG.ListTream)
                {
                    str2 += "{" + nTeam.Name + "}";
                }
                frmPubInput nIn = new frmPubInput("新建曲线组", str2);
                nIn.ShowDialog();
                if (nIn.DialogResult == System.Windows.Forms.DialogResult.OK)
                {
                    CLSTeamCurve nTeam = new CLSTeamCurve();
                    nTeam.Name = nIn.sOld;
                    ZedG.ListTream.Add(nTeam);
                    FillCurTreeList();
                }
                break;

            case "butTeamEdit":
                str2 = "";
                foreach (CLSTeamCurve nTeam in ZedG.ListTream)
                {
                    str2 += "{" + nTeam.Name + "}";
                }
                nIn = new frmPubInput(ZedG.SelTream.Name, str2);
                nIn.ShowDialog();
                if (nIn.DialogResult == System.Windows.Forms.DialogResult.OK)
                {
                    ZedG.SelTream.Name = nIn.sOld;
                    FillCurTreeList();
                }
                break;

            case "butTeamDel":
                if (MessageBox.Show("是否删除曲线组:" + ZedG.SelTream.Name + "?", "删除",
                                    MessageBoxButtons.YesNo, MessageBoxIcon.Question,
                                    MessageBoxDefaultButton.Button2) == DialogResult.No)//弹出确定对话框
                {
                    return;
                }
                for (int i = 0; i < ZedG.ListTream.Count; i++)
                {
                    if (ZedG.ListTream[i].Name == ZedG.SelTream.Name)
                    {
                        ZedG.ListTream.RemoveAt(i);
                        if (ZedG.ListTream.Count > 0)
                        {
                            ZedG.SelTream = ZedG.ListTream[Math.Max(i - 1, 0)];
                        }
                        else
                        {
                            ZedG.SelTream = null;
                        }
                        FillCurTreeList();
                    }
                }
                break;
            }
        }