예제 #1
0
        private void Read_All_ValueLabel()
        {
            DataTable dt = Main_DataBase_Builder.Select_Table("AllValuelabel");

            AllValue_Label_List.Clear();
            if (dt != null)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    try
                    {
                        NormalControls.MyLabel valuelabel = new NormalControls.MyLabel("Value");
                        valuelabel.MyName = dr[0].ToString();
                        valuelabel.Set_Text(dr[1].ToString());
                        valuelabel.Left   = int.Parse(dr[2].ToString());
                        valuelabel.Top    = int.Parse(dr[3].ToString());
                        valuelabel.Width  = int.Parse(dr[4].ToString());
                        valuelabel.Height = int.Parse(dr[5].ToString());
                        valuelabel.Set_BackColor(dr[6].ToString());
                        valuelabel.Set_FontSize(int.Parse(dr[8].ToString()));
                        valuelabel.Set_ForeColor(dr[9].ToString());
                        valuelabel.DataType     = dr[10].ToString();
                        valuelabel.Machine_num  = dr[11].ToString();
                        valuelabel.Offsite      = dr[12].ToString();
                        valuelabel.ValueAddress = dr[13].ToString();
                        AllValue_Label_List.Add(valuelabel);                                               // 将全部的标签加载进来
                    }
                    catch { }
                }
            }
        }
예제 #2
0
        private void 粘贴ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // 普通标签
            #region
            if (CopyType == "Normal")
            {
                string    where_cmd = "labelname='" + CopyObject_Name + "'";
                DataTable dt        = MainView.Main_DataBase_Builder.Select_Table("Alllabel", where_cmd);
                if (dt != null)
                {
                    if (dt.Rows.Count >= 1)
                    {
                        DataRow dr = dt.Rows[0];
                        NormalControls.MyLabel label = new NormalControls.MyLabel("Normal");
                        this.Controls.Add(label);
                        label.Left = 300;
                        label.Top  = 300;
                        label.Set_Text(dr[1].ToString());
                        label.Width  = int.Parse(dr[4].ToString());
                        label.Height = int.Parse(dr[5].ToString());
                        label.Set_BackColor(dr[6].ToString());
                        label.Set_FontSize(int.Parse(dr[8].ToString()));
                        label.Set_ForeColor(dr[9].ToString());
                        label.BringToFront();
                    }
                }
            }
            #endregion

            // 按钮
            #region
            if (CopyType == "Button")
            {
                string    where_cmd = "buttonname='" + CopyObject_Name + "'";
                DataTable dt        = MainView.Main_DataBase_Builder.Select_Table("AllButton", where_cmd);
                if (dt != null)
                {
                    if (dt.Rows.Count >= 1)
                    {
                        DataRow dr = dt.Rows[0];
                        NormalControls.MyButton button = new NormalControls.MyButton();
                        this.Controls.Add(button);
                        button.Left = 300;
                        button.Top  = 300;
                        button.SetText(dr[1].ToString());
                        button.Width  = int.Parse(dr[4].ToString());
                        button.Height = int.Parse(dr[5].ToString());
                        button.Set_BackColor(dr[6].ToString());
                        button.Set_FontSize(int.Parse(dr[8].ToString()));
                        button.Set_ForeColor(dr[9].ToString());
                        button.BringToFront();
                        //button.Button_Press += new EventHandler(Press_Button);
                    }
                }
            }
            #endregion
        }
예제 #3
0
        private void Show_Windows_Control(Form view)
        {
            view.Controls.Clear();
            DataTable dt = Main_DataBase_Builder.Select_Table(Selected_View_Name);

            if (dt != null)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    // 解析所有的标签
                    #region
                    if (dr[1].ToString() == "NormalLabel")
                    {
                        string    where_cmd = "labelname='" + dr[0].ToString() + "'";
                        DataTable labeldt   = Main_DataBase_Builder.Select_Table("Alllabel", where_cmd);
                        if (labeldt != null)
                        {
                            if (labeldt.Rows.Count > 0)
                            {
                                try
                                {
                                    DataRow labeldr = labeldt.Rows[0];
                                    NormalControls.MyLabel mylabel = new NormalControls.MyLabel("Normal");
                                    mylabel.MyName   = labeldr[0].ToString();
                                    mylabel.ViewName = view.Name;
                                    mylabel.Set_Text(labeldr[1].ToString());
                                    mylabel.Left   = int.Parse(labeldr[2].ToString());
                                    mylabel.Top    = int.Parse(labeldr[3].ToString());
                                    mylabel.Width  = int.Parse(labeldr[4].ToString());
                                    mylabel.Height = int.Parse(labeldr[5].ToString());
                                    mylabel.Set_BackColor(labeldr[6].ToString());
                                    mylabel.Set_FontSize(int.Parse(labeldr[8].ToString()));
                                    mylabel.Set_ForeColor(labeldr[9].ToString());
                                    view.Controls.Add(mylabel);
                                    //mylabel
                                }
                                catch { }
                            }
                        }
                    }
                    #endregion
                    // 解析所有的数据标签
                    #region
                    if (dr[1].ToString() == "ValueLabel")
                    {
                        NormalControls.MyLabel label = get_valuelabel(dr[0].ToString());
                        if (label != null)
                        {
                            view.Controls.Add(label);
                        }
                    }
                    #endregion

                    // 解析所有的按钮
                    #region
                    if (dr[1].ToString() == "Button")
                    {
                        string    where_cmd = "buttonname='" + dr[0].ToString() + "'";
                        DataTable buttondt  = Main_DataBase_Builder.Select_Table("AllButton", where_cmd);
                        if (buttondt != null)
                        {
                            if (buttondt.Rows.Count > 0)
                            {
                                try
                                {
                                    DataRow buttondr = buttondt.Rows[0];
                                    NormalControls.MyButton mybutton = new NormalControls.MyButton();
                                    mybutton.MyName   = buttondr[0].ToString();
                                    mybutton.ViewName = view.Name;
                                    mybutton.SetText(buttondr[1].ToString());
                                    mybutton.Left   = int.Parse(buttondr[2].ToString());
                                    mybutton.Top    = int.Parse(buttondr[3].ToString());
                                    mybutton.Width  = int.Parse(buttondr[4].ToString());
                                    mybutton.Height = int.Parse(buttondr[5].ToString());
                                    mybutton.Set_BackColor(buttondr[6].ToString());
                                    mybutton.Set_FontSize(int.Parse(buttondr[8].ToString()));
                                    mybutton.Set_ForeColor(buttondr[9].ToString());
                                    view.Controls.Add(mybutton);
                                    mybutton.Button_Press += new EventHandler(Press_Button);
                                    //mylabel
                                }
                                catch { }
                            }
                        }
                    }
                    #endregion
                }
            }
        }