Geeks With Blogs

News



Add to Google

Tim Hibbard CEO for EnGraph software

The MonthCalendar control is wider on Vista for some reason.  The control is 227 pixels wide instead of 182 pixels on XP.  If you have a form that only hosts this control, use this code to make it look better in Vista:

private void FormDateSelector_Load(object sender, EventArgs e) { if (Environment.OSVersion.Version.Major == 6) { this.Width = 227; } }

month_calendar

 

Technorati tags: , ,
Posted on Thursday, February 8, 2007 7:30 AM .NET , Vista | Back to top


Comments on this post: .NET MonthCalendar control on Vista

# re: .NET MonthCalendar control on Vista
Requesting Gravatar...
You should probably change that to >= 6 since you wouldn't expect future versions to revert back ;-)
Left by Daniel Moth on Apr 19, 2007 4:41 AM

# re: .NET MonthCalendar control on Vista
Requesting Gravatar...
I had the same problem on some computers with WinXP. You must not do that. If you look at the DateTimeEditor (in System.ComponentModel.Design), you can see that you must use the MonthCalender.Resize event. The monthCalendar resizes himself when it is shown. So with the resize event, you can resize your form to the montCalendar dimensions.
Left by Stéphane Mitermite on Jun 22, 2007 7:39 AM

# re: .NET MonthCalendar control on Vista
Requesting Gravatar...
I want to display the same old calendarstyle on vista like on xp - isn't it possible?
Left by VistaProblem on Sep 06, 2007 4:28 AM

# re: .NET MonthCalendar control on Vista
Requesting Gravatar...
try to comment the following line in Program.cs
Application.EnableVisualStyles();
Left by Robbie Han on Feb 16, 2009 7:26 PM

# re: .NET MonthCalendar control on Vista
Requesting Gravatar...
It should work with MonthCalender.Resize event better. It is the dedicated event for this kind of modifications, bijuterii argint.
Left by Surrin on Aug 23, 2011 3:34 AM

Your comment:
 (will show your gravatar)


Copyright © Tim Hibbard | Powered by: GeeksWithBlogs.net