<asp:calendar id="Calendar1" CellPadding="2" Width="160px" TitleStyle-BackColor="#000000" BorderColor="#aaaaaa" DayHeaderStyle-BackColor="#5e715e" OtherMonthDayStyle-ForeColor="#cccccc" DayNameFormat="Full" runat="server" TitleStyle-ForeColor="#ffffff" NextPrevStyle-ForeColor="#ffffff" CellSpacing="1" WeekendDayStyle-BackColor="#eeeeee" DayHeaderStyle-ForeColor="#ffffff" SelectionMode="None" TodayDayStyle-BorderColor="#5e715e" TodayDayStyle-BorderWidth="1" TodayDayStyle-Font-Bold="true" TodayDayStyle-ForeColor="#5e715e" > |
private int[] arrCurrentDays,arrPreDays,arrNextDays; //三個變數分別是當月,前一月,和下個月 private int intCurrentMonth,intPreMonth,intNextMonth; //三個整數陣列存放相對月份寫有blog的日期 protected System.Web.UI.WebControls.Calendar Calendar1; //這就是我們的日曆控制項了 |
private void Calendar1_PreRender(object sender, System.EventArgs e) { Thread threadCurrent = Thread.CurrentThread; CultureInfo ciNew = (CultureInfo)threadCurrent.CurrentCulture.Clone(); ciNew.DateTimeFormat.DayNames = new string[]{"日","一","二","三","四","五","六"}; ciNew.DateTimeFormat.FirstDayOfWeek = DayOfWeek.Sunday; threadCurrent.CurrentCulture = ciNew; } |
private void Calendar1_DayRender(object sender, System.Web.UI.WebControls.DayRenderEventArgs e) { //該控制項在建立每一天時發生。 CalendarDay d = ((DayRenderEventArgs)e).Day; TableCell c = ((DayRenderEventArgs)e).Cell; } |