日期:2014-05-18  浏览次数:20930 次

请大虾帮解释下以下代码,不胜感激
//bool isShow = true;//是
  //string strWebUserControls = "WebChart";

  //if (isShow)
  //{
  // string[] strUCs = strWebUserControls.Split(",".ToCharArray()[0]);
  // for (int i = 0; i < strUCs.Length; i++)
  // {
  // string strUCName = strUCs[i].ToString();
  // Control a = Page.LoadControl(strUCName + ".ascx");
  // //a.dt= GetDataSource;
  // this.ASPxPanel1.Controls.Add(a);
  // }
  //}
  //wc1._dt = GetDataSource;
  // ChartTitle t = new ChartTitle();
  //t.Text = "火车装车计划兑现分析";
  //t.Font = new System.Drawing.Font("Tahoma", 10);
  //wc1.t = t;

  //return;
  //this.ASPxPanel1.Controls.Add(WebChartControl5);
  //string asd = Interface.Manpower.AdapterManpower.Hello("")

------解决方案--------------------
C# code

            bool isShow = true;//是
            string strWebUserControls = "WebChart";

            if (isShow)
            {
             string[] strUCs = strWebUserControls.Split(",".ToCharArray()[0]);//将strWebUserControls转为字符串数组
             for (int i = 0; i < strUCs.Length; i++) //循环数组
             {
             string strUCName = strUCs[i].ToString();
             Control a = Page.LoadControl(strUCName + ".ascx");//根据内容加载Control
             //a.dt= GetDataSource;
             this.ASPxPanel1.Controls.Add(a);//添加组件
             }
            }
            wc1._dt = GetDataSource;//获取数据集
             ChartTitle t = new ChartTitle();//新建ChartTitle类
            t.Text = "火车装车计划兑现分析";
            t.Font = new System.Drawing.Font("Tahoma", 10);//重置t的字体
            wc1.t = t;

            return;
            this.ASPxPanel1.Controls.Add(WebChartControl5);
            string asd = Interface.Manpower.AdapterManpower.Hello("") //调用Interface.Manpower.AdapterManpower.Hello接口返回字符串