Exemple #1
0
 void timerUpTile2_Tick(object sender, EventArgs e)
 {
     if (tile2.Location.Y > 180)
     {
         tile2.SetBounds(tile2.Location.X, tile2.Location.Y - 1, tile2.Width, tile2.Height);
     }
     else
     {
         timerUpTile2.Stop();
     }
 }
Exemple #2
0
 void timerUpTile1_Tick(object sender, EventArgs e)
 {
     if (tile1.Location.Y > 268)
     {
         tile1.SetBounds(tile1.Location.X, tile1.Location.Y - 1, tile1.Width, tile1.Height);
     }
     else
     {
         timerUpTile1.Stop();
         timerMoveTile1.Start();
         timerMoveTile2.Start();
     }
 }
Exemple #3
0
        private void MetroCalendar_Load(object sender, EventArgs e)
        {
            dia_atual = DateTime.Now.Day;
            mes_atual = DateTime.Now.Month;
            ano_atual = DateTime.Now.Year;

            time = DateTime.Now;

            CurrentCulture = Application.CurrentCulture.Name;

            Thread.CurrentThread.CurrentCulture = new CultureInfo("pt-br"); //Altera a cultura para evitar data incorreta.

            lbl_mes.Text = Application.CurrentCulture.DateTimeFormat.GetMonthName(mes_atual);

            //Obtém o número de dias do mês e ano selecionado.
            int dayz = DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month);

            verificarDia(); //Verifica o dias...

            for (int i = 1; i <= dayz; i++)
            {
                ndays += 1;

                tileDays      = new MetroTile();
                tileDays.Name = "Day" + i;
                tileDays.Text = i.ToString();

                if (i == DateTime.Now.Day)
                {
                    tileDays.Style = MetroColorStyle.Green;
                }
                else if (ndays == 01)
                {
                    tileDays.Style = MetroColorStyle.Yellow;
                }
                else
                {
                    tileDays.Style = MetroColorStyle.Red;
                }

                tileDays.SetBounds(x, y, 47, 47);

                x += 48;

                if (ndays == 7)
                {
                    x     = 0;
                    ndays = 0;
                    y    += 48;
                }

                pnl_dias.Controls.Add(tileDays);
            }

            //Return all values to default.
            x     = 0;
            ndays = 0;
            y     = 0;
        }
Exemple #4
0
        private void lnk_anterior_Click(object sender, EventArgs e)
        {
            if (mes_atual == 1)
            {
                ano_atual -= 1;
                mes_atual  = 12;
            }
            else
            {
                mes_atual -= 1;
            }

            pnl_dias.Controls.Clear();

            Thread.CurrentThread.CurrentCulture = new CultureInfo(CurrentCulture);

            //Mostra o nome do mês selecionado.
            lbl_mes.Text = Application.CurrentCulture.DateTimeFormat.GetMonthName(mes_atual);

            Thread.CurrentThread.CurrentCulture = new CultureInfo("pt-br");

            int dayz = DateTime.DaysInMonth(ano_atual, mes_atual);

            verificarDia();

            for (int i = 1; i <= dayz; i++)
            {
                ndays += 1;

                tileDays      = new MetroTile();
                tileDays.Text = i.ToString();

                int mon = mes_atual;
                int yea = ano_atual;

                if ((i == dia_atual) && (mon == DateTime.Now.Month) && (yea == DateTime.Now.Year))
                {
                    tileDays.Style = MetroColorStyle.Green;
                }
                else if (ndays == 01)
                {
                    tileDays.Style = MetroColorStyle.Yellow;
                }
                else
                {
                    tileDays.Style = MetroColorStyle.Red;
                }

                tileDays.SetBounds(x, y, 47, 47);

                x += 48;

                if (ndays == 7)
                {
                    x     = 0;
                    ndays = 0;
                    y    += 48;
                }

                pnl_dias.Controls.Add(tileDays);
            }

            x     = 0;
            ndays = 0;
            y     = 0;
        }