From 43013462fdbc0cb2d0a3553ee0a32a91df47608e Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Thu, 12 Oct 2006 10:00:44 +0000 Subject: [PATCH] 2006-10-12 Rolf Bjarne Kvinge * MonthCalendar.cs: When FirstDayOfWeek is default set firstday to ui thread's settings instead of sunday. * ThemeWin32Classic.cs: Localize the day string. Fixes #79563 svn path=/trunk/mcs/; revision=66593 --- .../Managed.Windows.Forms/System.Windows.Forms/ChangeLog | 6 ++++++ .../System.Windows.Forms/MonthCalendar.cs | 2 +- .../System.Windows.Forms/ThemeWin32Classic.cs | 3 ++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog index 93cfec917beee..e60396d51f73c 100644 --- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog +++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog @@ -1,3 +1,9 @@ +2006-10-12 Rolf Bjarne Kvinge + + * MonthCalendar.cs: When FirstDayOfWeek is default set firstday + to ui thread's settings instead of sunday. + * ThemeWin32Classic.cs: Localize the day string. Fixes #79563 + 2006-10-12 Rolf Bjarne Kvinge * DateTimePicker.cs diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MonthCalendar.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MonthCalendar.cs index 8ce720b68433e..c97f6bb5bb316 100644 --- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MonthCalendar.cs +++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MonthCalendar.cs @@ -1389,7 +1389,7 @@ private void AddTimeToSelection (int delta, bool isDays) // convert a Day enum into a DayOfWeek enum internal DayOfWeek GetDayOfWeek (Day day) { if (day == Day.Default) { - return DayOfWeek.Sunday; + return Threading.Thread.CurrentThread.CurrentUICulture.DateTimeFormat.FirstDayOfWeek; } else { return (DayOfWeek) DayOfWeek.Parse (typeof (DayOfWeek), day.ToString ()); } diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeWin32Classic.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeWin32Classic.cs index 08089edd16358..1905d7d7eabd0 100644 --- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeWin32Classic.cs +++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeWin32Classic.cs @@ -2484,6 +2484,7 @@ private void DrawSingleMonth(Graphics dc, Rectangle clip_rectangle, Rectangle re Size title_size = (Size)((object)mc.title_size); Size date_cell_size = (Size)((object)mc.date_cell_size); DateTime current_month = (DateTime)((object)mc.current_month); + DateTime sunday = new DateTime(2006, 10, 1); // draw the title back ground DateTime this_month = current_month.AddMonths (row*mc.CalendarDimensions.Width+col); @@ -2545,7 +2546,7 @@ private void DrawSingleMonth(Graphics dc, Rectangle clip_rectangle, Rectangle re day_name_rect.Y, date_cell_size.Width, date_cell_size.Height); - dc.DrawString (((DayOfWeek)i).ToString().Substring(0, 3), mc.Font, ResPool.GetSolidBrush (mc.TitleBackColor), day_rect, mc.centered_format); + dc.DrawString (sunday.AddDays (i + (int) first_day_of_week).ToString ("ddd"), mc.Font, ResPool.GetSolidBrush (mc.TitleBackColor), day_rect, mc.centered_format); } // draw the vertical divider