Ejemplo n.º 1
0
 private void FaceSelection(PackControl.PackFace Choosen)
 {
     //string choosen = "";
     //for (int i = 0; i < PackButtons.Length; i++)
     //{
     //    if (PackButtons[i].Selected)
     //        choosen += ", " + PackButtons[i].PackName;
     //}
     //labelChoosen.Text = choosen;
 }
Ejemplo n.º 2
0
        private void CreatePanel(int iCols, int iRows)
        {
            PackFaces = pack.GetChildRows("pack_face_prize_level_has_prize_level");

            // just docked' the container to the form... so user can resize as needed. (might just have scrollbar option on it too)
            //panelPackLayout.Width = iCols * CellSize;
            //panelPackLayout.Height = iRows * CellSize;

            panelPackLayout.Controls.Clear();
            FaceButtons = new PackControl.PackFace[iCols * iRows];

            int i = 0;

            for (int pos_y = 0; pos_y < iRows; pos_y++)
            {
                for (int pos_x = 0; pos_x < iCols; pos_x++)
                {
                    FaceButtons[i]          = new PackControl.PackFace();
                    FaceButtons[i].Location = new Point(CellSize * pos_x, CellSize * pos_y);
                    FaceButtons[i].Size     = new Size(CellSize, CellSize);

                    // IT SHOULD WORK WITH CURRENT PACK FACE ???
                    //DataRow[] Facedr = data.current_pack_face_prize_level.Select("face = " + i);
                    //DataRow[] Facedr = data.pack_face_prize_level.Select("pack_id = " + this.pack["pack_id"] + " AND  face = " + i);

                    // CREATE ALL GENERAL BUTTONS GRAY COLOR
                    FaceButtons[i].SetPack(DBNull.Value, this.pack["pack_id"], DBNull.Value, i
                                           , DBNull.Value, Color.FromName("Gray"));

                    FaceButtons[i].SetFace(i);
                    FaceButtons[i].OnSelectedFace += new PackControl.PackFace.SelectedFace(FaceSelection);
                    panelPackLayout.Controls.Add(FaceButtons[i]);

                    i++;
                }
            }

            foreach (DataRow dr in PackFaces)
            {
                if (FaceButtons.Length > Convert.ToInt32(dr["face"]))
                {
                    DataRow color_row = dr.GetParentRow(PackFacePrizeLevel.TableName + "_is_color");

                    FaceButtons[Convert.ToInt32(dr["face"])].SetPack(
                        dr["pack_face_prize_level_id"]
                        , dr["pack_id"]
                        , dr["prize_level_id"]
                        , Convert.ToInt32(dr["face"])
                        , dr[ColorInfoTable.PrimaryKey]
                        , (color_row != null)?((Color)(color_row["color"])):Color.Gray);
                }
            }
            //ResizeForm();
        }