예제 #1
0
        /// <summary>
        /// 貼圖
        /// </summary>
        private void PrintButtonList()
        {
            //貼圖
            int  X_POS = 0, Y_POS = 0, X_Width = 0, Y_Width = 0, i = 0;
            bool NoLeftButton = false;

            while (NoLeftButton == false)
            {
                NoLeftButton = true;
                foreach (Control con in this.Controls)
                {
                    if (con.Name.ToUpper().IndexOf("DT_COMBOLIST_BTN") >= 0)
                    {
                        Controls.Remove(con);
                        NoLeftButton = false;
                    }
                }
            }

            foreach (DataRow dr in dt_ComboList.Rows)
            {
                i++;
                X_POS   = Convert.ToInt32(dr["X_POS"]);
                Y_POS   = Convert.ToInt32(dr["Y_POS"]);
                X_Width = Convert.ToInt32(dr["X_Width"]);
                Y_Width = Convert.ToInt32(dr["Y_Width"]);
                if (X_POS > 0 || Y_POS > 0)
                {
                    Car_Fun.myButton btn = new Car_Fun.myButton();
                    btn.Name      = "DT_COMBOLIST_BTN" + i.ToString();
                    btn.Text      = dr["Name"].ToString();
                    btn.ForeColor = Color_tbFocus_ForeColor;
                    btn.BackColor = Color_tbFocus_BackColor;
                    btn.Size      = new Size(X_Width, Y_Width);
                    btn.Location  = new Point(lbl_StartXY.Location.X + X_POS, lbl_StartXY.Location.Y + Y_POS);
                    btn.Click    += MapBtnClick;
                    this.Controls.Add(btn);
                }
            }
            this.Refresh();
        }
예제 #2
0
        private void MapBtnClick(object sender, EventArgs e)
        {
            Car_Fun.myButton btn = sender as Car_Fun.myButton;

            switch (lbl_StartXY.Text)
            {
            case "Stock":
                lbl_StartXY.Text = "Aisle";
                btn_Aisle.Text   = btn.Text;
                break;

            case "Aisle":
                lbl_StartXY.Text  = "Location";
                btn_Location.Text = btn.Text;
                break;

            case "Location":
                lbl_StartXY.Text = "Bin";
                break;
            }
            GetComboList(btn.Text);
            PrintButtonList();
        }