Exemplo n.º 1
0
 private void Afisha_Load(object sender, EventArgs e)
 {
     performance_list           = new Performance_list();
     performance_list.MdiParent = this;
     performance_list.Top       = metroPanel1.Bottom;
     performance_list.Show();
     performance_list.Basic_text();
     Month_buttons();
 }
Exemplo n.º 2
0
        private void Afisha_Load(object sender, EventArgs e)
        {
            int    i = 0;
            Months m;

            f           = new Performance_list();
            f.MdiParent = this;
            f.Top       = metroPanel1.Bottom;
            f.Show();
            f.Performance_Create();
            using (SqlConnection connection = new SqlConnection(DB_connection.connectionString))
            {
                connection.Open();
                SqlCommand    command = new SqlCommand("SELECT DISTINCT TOP 4 MONTH(Date), YEAR(Date) AS x FROM Afisha_dates WHERE(MONTH(Date) >= MONTH(GETDATE()) AND YEAR(Date) >= YEAR(GETDATE())) OR YEAR(Date) > YEAR(GETDATE()) ORDER BY x", connection);
                SqlDataReader reader  = command.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        Button b = new Button();
                        b.FlatStyle = FlatStyle.Flat;
                        m           = (Months)reader.GetInt32(0);
                        b.Text      = m + "\n" + reader.GetValue(1).ToString();
                        b.AutoSize  = false;
                        b.Size      = new Size(82, 49);
                        b.Font      = new Font("Century Gothic", 10, FontStyle.Regular);
                        b.Tag       = reader.GetValue(0);
                        b.BringToFront();
                        b.Click += new System.EventHandler(this.button1_Click);
                        panel1.Controls.Add(b);
                        i++;
                    }
                }
                int j = 0;
                int k = (797 - (82 * i + (i - 1) * 22)) / 2;
                foreach (Button b in panel1.Controls)
                {
                    panel1.Controls[j].Location = new Point(k + j * 82 + j * 22, 7);
                    j++;
                }
            }
        }