Ejemplo n.º 1
0
        private void PanelMonth_MouseClick(object sender, EventArgs e)
        {
            PanelDay pd = (PanelDay)sender;

            pd.BackColor         = Color.FromArgb(101, 147, 74);
            datetime             = new DateTime(dateTimePicker.Value.Year, dateTimePicker.Value.Month, Convert.ToInt32(pd.Solar));
            dateTimePicker.Value = datetime;
            DisplayPD(datetime);

            //PMEvent?.Invoke(this, e);
        }
Ejemplo n.º 2
0
        private void PanelMonth_MouseLeave(object sender, EventArgs e)
        {
            PanelDay pd = (PanelDay)sender;

            if (DateTime.Now.Day == pd.date() && datetime.Year == DateTime.Now.Year && datetime.Month == DateTime.Now.Month)
            {
                pd.BackColor = Color.FromArgb(252, 157, 154);
            }
            else if (dateTimePicker.Value.Year != datetime.Year || dateTimePicker.Value.Month != datetime.Month || dateTimePicker.Value.Day != Convert.ToInt32(pd.Solar))
            {
                pd.BackColor = this.BackColor;
            }
        }
Ejemplo n.º 3
0
        public void DisplayPD(DateTime datetime)
        {
            panelWall.Controls.Clear();
            DateTimeDS dt  = new DateTimeDS();
            int        dim = dt.daysInMonth(dateTimePicker.Value.Year, dateTimePicker.Value.Month);

            PanelDay[] panelday = new PanelDay[dim];
            for (int d = 0; d < dim; d++)
            {
                panelday[d]             = new PanelDay();
                panelday[d].Name        = "pd" + (d + 1).ToString();
                panelday[d].Solar       = MyString(d + 1);
                panelday[d].Lunar       = dt.getLunarDay(dateTimePicker.Value.Year, dateTimePicker.Value.Month, d + 1);
                panelday[d].MouseEnter += new EventHandler(PanelMonth_MouseEnter);
                panelday[d].MouseLeave += new EventHandler(PanelMonth_MouseLeave);
                panelday[d].MouseClick += PanelMonth_MouseClick;
                panelday[d].Terms       = dt.terms(new DateTime(dateTimePicker.Value.Year, dateTimePicker.Value.Month, d + 1));
                if (DateTime.Now.Day == d + 1 && datetime.Year == DateTime.Now.Year && datetime.Month == DateTime.Now.Month)
                {
                    panelday[d].BackColor = Color.FromArgb(252, 157, 154);
                }
                if (datetime.Day == d + 1)
                {
                    panelday[d].BackColor = Color.FromArgb(101, 147, 74);
                }
            }
            int      index        = 0;
            DateTime newtime      = dateTimePicker.Value;
            DateTime firstdaytime = new DateTime(newtime.Year, newtime.Month, 1);
            int      firstday     = (int)firstdaytime.DayOfWeek;

            for (int i = 0; i < 6; i++)
            {
                for (int j = 0; j < 7; j++)
                {
                    if (i == 0 && j < firstday)
                    {
                    }
                    else if (index < dim)
                    {
                        Add(panelday[index], j, i);
                        index++;
                    }
                }
            }
        }
Ejemplo n.º 4
0
 public void Add(PanelDay pd)
 {
     panelWall.Controls.Add(pd);
 }
Ejemplo n.º 5
0
 public void Add(PanelDay pd, int x, int y)
 {
     pd.Location = new System.Drawing.Point(x * 70, y * 92);
     panelWall.Controls.Add(pd);
 }