コード例 #1
0
        private void PanelDay_OnSetIdolClick(string day)
        {
            int iii = PanelMonth.IdolList.FindIndex(t => t == txtYear.Text.PadLeft(4, '0') + txtMonth.Text.PadLeft(2, '0') + day.PadLeft(2, '0'));

            if (iii == -1)
            {
                PanelMonth.IdolList.Add(txtYear.Text.PadLeft(4, '0') + txtMonth.Text.PadLeft(2, '0') + day.PadLeft(2, '0'));
            }
            foreach (var control in flpControls.Controls)
            {
                if (control is PanelDay)
                {
                    PanelDay panelDay = control as PanelDay;
                    iii = PanelMonth.IdolList.FindIndex(t => t == txtYear.Text.PadLeft(4, '0') + txtMonth.Text.PadLeft(2, '0') + panelDay.Day.PadLeft(2, '0'));
                    //if (iii != -1)
                    //    PanelMonth.IdolList.Add(txtYear.Text.PadLeft(4, '0') + txtMonth.Text.PadLeft(2, '0') + day.PadLeft(2, '0'));
                    if (iii != -1)
                    {
                        panelDay.IsSet = true;
                        panelDay.SetIdol();
                    }
                    else
                    {
                        panelDay.IsSet = false;
                        panelDay.SetIdol();
                    }
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// 点击选中日期
        /// </summary>
        /// <param name="day"></param>
        private void PanelDay_OnClick(string day)
        {
            foreach (var control in flpControls.Controls)
            {
                if (control is PanelDay)
                {
                    PanelDay panelDay = control as PanelDay;
                    if (panelDay.Day == day)
                    {
                        panelDay.IsSelect = true;
                        if (!panelDay.IsSet)
                        {
                            panelDay.SetValue();
                        }
                    }
                    else if (panelDay.IsSelect == true)
                    {
                        panelDay.IsSelect = false;
                        if (!panelDay.IsSet)
                        {
                            panelDay.SetValue();
                        }
                    }
                }
            }

            string year  = txtYear.Text.Trim();
            string month = txtMonth.Text.Trim();

            DateTime date = new DateTime(int.Parse(year), int.Parse(month), int.Parse(day));

            //OnClick?.Invoke(string.Format("{0}年{1}月{2}日", year, month, day));
            OnClick?.Invoke(date);
        }
コード例 #3
0
        /// <summary>
        /// 添加日期
        /// </summary>
        /// <param name="isSelect">当天是否被选中</param>
        /// <param name="day">日期</param>
        private void Add(bool isSelect, bool isSet, string day)
        {
            PanelDay panelDay = new PanelDay();

            panelDay.Day      = day;
            panelDay.IsSelect = isSelect;
            panelDay.IsSet    = isSet;
            panelDay.SetValue();
            panelDay.SetIdol();
            panelDay.OnClick        += PanelDay_OnClick;
            panelDay.OnSetIdolClick += PanelDay_OnSetIdolClick;
            flpControls.Controls.Add(panelDay);
        }