Ejemplo n.º 1
0
 /// <summary>
 /// 重绘前景方法
 /// </summary>
 /// <param name="paint">绘图对象</param>
 /// <param name="clipRect">裁剪区域</param>
 public override void onPaintForeground(FCPaint paint, FCRect clipRect)
 {
     if (m_calendar != null)
     {
         int            width = Width, height = Height;
         FCFont         font = Font;
         String         text = "";
         FCCalendarMode mode = m_calendar.Mode;
         //日
         if (mode == FCCalendarMode.Day)
         {
             CMonth month = m_calendar.Month;
             text = month.Year.ToString() + "年" + month.Month.ToString() + "月";
         }
         //月
         else if (mode == FCCalendarMode.Month)
         {
             text = m_calendar.MonthDiv.Year.ToString() + "年";
         }
         //年
         else if (mode == FCCalendarMode.Year)
         {
             int startYear = m_calendar.YearDiv.StartYear;
             text = startYear.ToString() + "年 - " + (startYear + 12).ToString() + "年";
         }
         FCSize tSize = paint.textSize(text, font);
         FCRect tRect = new FCRect();
         tRect.left   = (width - tSize.cx) / 2;
         tRect.top    = (height - tSize.cy) / 2;
         tRect.right  = tRect.left + tSize.cx + 1;
         tRect.bottom = tRect.top + tSize.cy + 1;
         paint.drawText(text, getPaintingTextColor(), font, tRect);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 触摸点击事件
 /// </summary>
 /// <param name="touchInfo">触摸信息</param>
 public override void onClick(FCTouchInfo touchInfo)
 {
     base.onClick(touchInfo);
     if (m_calendar != null)
     {
         FCCalendarMode mode = m_calendar.Mode;
         //日
         if (mode == FCCalendarMode.Day)
         {
             if (m_toLast)
             {
                 m_calendar.goLastMonth();
             }
             else
             {
                 m_calendar.goNextMonth();
             }
         }
         //月
         else if (mode == FCCalendarMode.Month)
         {
             MonthDiv monthDiv = m_calendar.MonthDiv;
             if (monthDiv != null)
             {
                 int year = monthDiv.Year;
                 if (m_toLast)
                 {
                     monthDiv.selectYear(year - 1);
                 }
                 else
                 {
                     monthDiv.selectYear(year + 1);
                 }
             }
         }
         //年
         else if (mode == FCCalendarMode.Year)
         {
             YearDiv yearDiv = m_calendar.YearDiv;
             if (yearDiv != null)
             {
                 int year = yearDiv.StartYear;
                 if (m_toLast)
                 {
                     yearDiv.selectStartYear(year - 12);
                 }
                 else
                 {
                     yearDiv.selectStartYear(year + 12);
                 }
             }
         }
         m_calendar.invalidate();
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 触摸点击方法
 /// </summary>
 /// <param name="touchInfo">触摸信息</param>
 public override void onClick(FCTouchInfo touchInfo)
 {
     base.onClick(touchInfo);
     if (m_calendar != null)
     {
         FCCalendarMode mode = m_calendar.Mode;
         //日
         if (mode == FCCalendarMode.Day)
         {
             m_calendar.Mode = FCCalendarMode.Month;
         }
         //月
         else if (mode == FCCalendarMode.Month)
         {
             m_calendar.Mode = FCCalendarMode.Year;
         }
         m_calendar.update();
         m_calendar.invalidate();
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 重绘前景方法
        /// </summary>
        /// <param name="paint">绘图对象</param>
        /// <param name="clipRect">裁剪区域</param>
        public override void onPaintForeground(FCPaint paint, FCRect clipRect)
        {
            int            width = Width, height = Height;
            FCCalendarMode mode = m_calendar.Mode;

            //画星期标题
            if (mode == FCCalendarMode.Day)
            {
                float  left        = 0;
                FCSize weekDaySize = new FCSize();
                FCFont font        = Font;
                long   textColor   = getPaintingTextColor();
                for (int i = 0; i < m_weekDays.Length; i++)
                {
                    weekDaySize = paint.textSize(m_weekDays[i], font);
                    float  textX = left + (width / 7F) / 2F - weekDaySize.cx / 2F;
                    float  textY = height - weekDaySize.cy;
                    FCRect tRect = new FCRect(textX, textY, textX + weekDaySize.cx, textY + weekDaySize.cy);
                    paint.drawText(m_weekDays[i], textColor, font, tRect);
                    left += Width / 7F;
                }
            }
        }