예제 #1
0
        //通过父容器ID遍历控件
        private void GetControlByParentId(int parentid)
        {
            string    sql = "select * from board_param where parentid = " + parentid.ToString();
            DataTable dt  = Global.mysqlHelper.GetDataTable(sql);

            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    ControlBoard cb = new ControlBoard(dr);
                    Global.listControls.Add(cb);
                    if (cb.LinkIndex > 0)
                    {
                        if (cb.LinkKind == "area")
                        {
                            Global.DicAreaIndexInList.Add(cb.LinkIndex, Global.listControls.IndexOf(cb));
                        }
                        else if (cb.LinkKind == "nozzle")
                        {
                            Global.DicNozzleIndexInList.Add(cb.LinkIndex, Global.listControls.IndexOf(cb));
                        }
                    }
                    GetControlByParentId(cb.id);
                }
            }
        }
예제 #2
0
 //遍历控件并存入数据库
 private void ForeachStationBoard(Control cointainer, int level, int parentid)
 {
     foreach (Control con in cointainer.Controls)
     {
         ControlBoard cb = new ControlBoard();
         cb.LocationX   = con.Location.X;
         cb.LocationY   = con.Location.Y;
         cb.ShowText    = con.Text.Trim();
         cb.Visible     = con.Visible;
         cb.Visible     = true;
         cb.Editable    = con.Enabled;
         cb.BaseColor   = con.BackColor.ToString();
         cb.ControlName = con.Name;
         cb.ControlType = con.GetType().ToString();
         cb.level       = level;
         cb.ParentId    = parentid;
         cb.id          = Global.mysqlHelper.ExecuteSqlGetId(cb.getInsertSQL());
         ForeachStationBoard(con, level + 1, cb.id);
     }
 }
예제 #3
0
        //刷新单个控件显示状态
        private void FlushSingleControlsSatus(ControlBoard cb)
        {
            Control con = (Control)this.GetType().GetField(cb.ControlName, System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.IgnoreCase).GetValue(this);

            con.Location = new Point(cb.LocationX, cb.LocationY);
            con.Visible  = true;
            //con.BackColor = cb.BaseColor;
            if (Global.bStationBoardInSet && !cb.Visible && cb.level > 1) //设置状态下,隐藏控件背景为灰色
            {
                con.BackColor = Color.Gray;
            }
            else if (!cb.Visible)
            {
                con.Visible = false;
                return;
            }

            if (Global.bStationBoardInSet && cb.LinkKind == "island")
            {
                con.BackColor = Color.SeaShell;
            }
            else if (cb.LinkKind == "island")
            {
                con.BackColor = Color.Transparent;
            }

            con.Text = cb.ShowText;
            if (Global.bStationBoardInSet && cb.LinkKind == "area")
            {
                con.Text = cb.ShowText;
            }
            else if (cb.LinkKind == "area")
            {
                con.Text = cb.RunText;
            }
        }
예제 #4
0
        private void GetSatationBoardParamFromDB()
        {
            Global.listControls.Clear();
            Global.DicAreaIndexInList.Clear();
            Global.DicNozzleIndexInList.Clear();
            string sql = "select * from board_param where name = ";

            if (Global.nStationBoardDirection == 0)
            {
                sql = sql + "'StationBoardHorizon'";
            }
            else
            {
                sql = sql + "'StationBoardVertical'";
            }
            DataTable dt = Global.mysqlHelper.GetDataTable(sql);

            if (dt != null && dt.Rows.Count > 0)
            {
                ControlBoard cb = new ControlBoard(dt.Rows[0]);
                Global.listControls.Add(cb);
                GetControlByParentId(cb.id);
            }
        }