Trouble with MonthCalendar control
Just start a new Windows Forms Application and change the Form1 constructor to this code(which was copied from MSDN)
public Form1()
{
InitializeComponent();
// Create the calendar.
MonthCalendar monthCalendar2 = new System.Windows.Forms.MonthCalendar();
// Set the calendar location.
monthCalendar2.Location = new System.Drawing.Point(50, 50);
// Change the color.
monthCalendar2.BackColor = System.Drawing.SystemColors.Info;
monthCalendar2.ForeColor = System.Drawing.Color.FromArgb(
((System.Byte)(192)), ((System.Byte)(0)), ((System.Byte)(192)));
monthCalendar2.TitleBackColor = System.Drawing.Color.Purple;
monthCalendar2.TitleForeColor = System.Drawing.Color.Yellow;
monthCalendar2.TrailingForeColor = System.Drawing.Color.FromArgb(
((System.Byte)(192)), ((System.Byte)(192)), ((System.Byte)(0)));
// Do not show the "Today" banner.
monthCalendar2.ShowToday = false;
// Do not circle today's date.
monthCalendar2.ShowTodayCircle = false;
this.Controls.Add(monthCalendar2);
}
My problem is that the color changes don't show and I wonder why.
I feel like I'm omitting something, but having searched here, there and everywhere I am stuck. Is it my OS?(Vista)
Thanks in advance for any enlightment on this.:S
ddanbe
Senior Poster
3,829 posts since Oct 2008
Reputation Points: 2,070
Solved Threads: 661
Yes, Danny, it's Vista problem (Aero, and Vista basic) color scheme, if you turn it into Windows Classic it'd work.
Or, remove Vista style
[STAThread]
static void Main()
{
//Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276
Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276
Thanks Ramy!
I indeed have Vista Basic.
Your suggestions all work, so I consider this as solved.
Thanks again!
ddanbe
Senior Poster
3,829 posts since Oct 2008
Reputation Points: 2,070
Solved Threads: 661