コード例 #1
0
ファイル: Form1.cs プロジェクト: CegepGarneau/tache
        private TableLayoutPanelCellPosition CalculerPosition(BlocHoraire bloc)
        {
            TableLayoutPanelCellPosition pos = new TableLayoutPanelCellPosition(-1, -1);

            pos.Column = (int)bloc.Jour * NbJours + (int)bloc.Local;
            pos.Row = bloc.HeureDebut - HeureDebutJournee;

            return pos;
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: CegepGarneau/tache
        private void AfficherBlocHoraire(List<object> oTagInfo, String prof, Cours cours, BlocHoraire bloc)
        {
            Debug.Assert(bloc.EstAffecte);

            //On conserve seuelement les lettres majuscules pour identitfier le prof.
            prof = String.Concat(prof.Select(c => char.IsUpper(c) ? c.ToString() : String.Empty));

            //On enlève les 0 et les lettres du numéro du groupe.
            string groupe = "Gr " + Regex.Match(cours.NoGroupe.Replace("0", ""), @"\d+").Value;

            //On conserve seulement une partie du numéro du cours
            String numero = cours.Numero.Remove(0, 4).Remove(3, 3);

            TableLayoutPanelCellPosition pos = CalculerPosition(bloc);

            // Affichage du Label
            System.Windows.Forms.Label lblCours = new System.Windows.Forms.Label();
            lblCours.Text = numero + "\n" + prof + "\n" + groupe;
            lblCours.Anchor = AnchorStyles.Left;
            lblCours.Margin = new Padding(0);
            lblCours.AutoSize = false;
            lblCours.BackColor = GetCouleurFromNumCours(numero);
            lblCours.Width = tableLayoutPanel1.GetColumnWidths()[pos.Column];
            lblCours.Height = tableLayoutPanel1.GetRowHeights()[pos.Row] * bloc.NbHeures;
            lblCours.ContextMenuStrip = this.contextMenuStrip1;
            lblCours.MouseDown += new System.Windows.Forms.MouseEventHandler(this.coursLabel_MouseDown);
            lblCours.AllowDrop = true;

            lblCours.Tag = oTagInfo;

            this.tableLayoutPanel1.Controls.Add(lblCours, pos.Column, pos.Row);
            this.tableLayoutPanel1.SetRowSpan(lblCours, bloc.NbHeures);
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: CegepGarneau/tache
        private void MettreAjourBlocFromPos(TableLayoutPanelCellPosition pos, BlocHoraire bloc)
        {
            //On obtien le jour de la semaine selon la position dans la grille
            bloc.Jour = GetJour(pos);

            //on obtien le numéro du local selon la position dans la grille
            bloc.Local = GetLocal(pos);

            //on obtien l'heure
            bloc.HeureDebut = GetHeure(pos);
        }