コード例 #1
0
        public ColorUpdateForm(ListViewItem lviItem, WACDbContext db)
        {
            InitializeComponent();
            this.listViewItem = lviItem;
            this.db           = db;
            int colorId = (int)lviItem.Tag;

            Models.Color selectedColor = db.Colors.Where(x => x.Id == colorId).FirstOrDefault();
            txtColorName.Text = selectedColor.ColorName;
            nudRed.Value      = selectedColor.Red;
            nudGreen.Value    = selectedColor.Green;
            nudBlue.Value     = selectedColor.Blue;

            //Color Convert İmage https://dyclassroom.com/csharp-project/how-to-convert-a-color-image-into-red-green-blue-image-in-csharp-using-visual-studio
            Bitmap newbmp = new Bitmap(62, 62);

            for (int x = 0; x < newbmp.Height; x++)
            {
                for (int y = 0; y < newbmp.Width; y++)
                {
                    newbmp.SetPixel(x, y, System.Drawing.Color.FromArgb(selectedColor.Red, selectedColor.Green, selectedColor.Blue));
                }
            }
            pboColor.Image = newbmp;
        }
コード例 #2
0
        public TeamUpdateForm(WACDbContext db, Team selectedTeam)
        {
            InitializeComponent();
            this.db                  = db;
            this.selectedTeam        = selectedTeam;
            txtTeamName.Text         = selectedTeam.TeamName;
            lstTeamColors.DataSource = selectedTeam.Colors.ToList();
            imgList.ImageSize        = new Size(16, 16);
            lviColors.LargeImageList = imgList;
            lviColors.Items.Clear();
            foreach (var item in db.Colors)
            {
                ListViewItem lvi = new ListViewItem();
                lvi.Name = item.ColorName;
                lvi.Text = $"{item.ColorName}";
                lvi.Tag  = item.Id;

                Bitmap newbmp = new Bitmap(62, 62);

                for (int x = 0; x < newbmp.Height; x++)
                {
                    for (int y = 0; y < newbmp.Width; y++)
                    {
                        newbmp.SetPixel(x, y, System.Drawing.Color.FromArgb(item.Red, item.Green, item.Blue));
                    }
                }
                imgList.Images.Add($"{item.ColorName}", newbmp);
                lvi.ImageKey = item.ColorName;
                lviColors.Items.Add(lvi);
            }
        }
コード例 #3
0
        public MatchUpdateForm(WACDbContext db, Match match)
        {
            InitializeComponent();
            this.db    = db;
            this.match = match;
            LoadResults();
            txtTeam1.Text       = match.Team1.TeamName;
            txtTeam2.Text       = match.Team2.TeamName;
            dtpMatchTime.Value  = match.MatchTime;
            nudTeam1Score.Value = match.Score1;
            nudTeam2Score.Value = match.Score2;
            switch (match.Result)
            {
            case (null):
                cboResult.SelectedIndex = -1;
                break;

            case (Result.Draw):
                cboResult.SelectedIndex = 0;
                break;

            case (Result.Team1Win):
                cboResult.SelectedIndex = 1;
                break;

            case (Result.Team2Win):
                cboResult.SelectedIndex = 2;
                break;

            default:
                break;
            }
        }
コード例 #4
0
 public NewMatchForm(WACDbContext db)
 {
     InitializeComponent();
     this.db = db;
     LoadTeams();
     LoadResults();
     cboTeam1.SelectedIndex  = -1;
     cboTeam2.SelectedIndex  = -1;
     cboResult.SelectedIndex = -1;
 }
コード例 #5
0
 public PlayerUpdateForm(WACDbContext db, Player player)
 {
     InitializeComponent();
     this.db                 = db;
     this.player             = player;
     txtPlayerName.Text      = player.PlayerName;
     txtPlayerPhotoPath.Text = player.PhotoPath;
     pboPlayerPhoto.Image    = (Bitmap) new ImageConverter().ConvertFrom(player.Photo);
     LoadTeams();
     cboTeams.SelectedItem = player.Team;
 }