Is there any possible way to change the calendar control width and height . I want to change the width and height of the calendar . These step when i google i found 1) Drop the month calendar in panel and allow dropping true . And Increase the size the panel . Does not work for me . 2) Drop the month calendar calendar in group box and dock fill . This display many months with the this month. 3) Increase the font size of the calendar control, does not work for me.
Is there any way to do this . Thanks in advance for your comments
When the MonthCalendar
control is rendered using visual styles, its size just follows system settings and you cannot change its size. However, as an option you can disable visual styles for this control and set a larger font for the control to change its size using SetWindowTheme
:
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
public class MyMonthCalendar : MonthCalendar
{
[DllImport("uxtheme.dll", ExactSpelling = true, CharSet = CharSet.Unicode)]
static extern int SetWindowTheme(IntPtr hwnd, string pszSubAppName, string pszSubIdList);
protected override void OnHandleCreated(EventArgs e)
{
SetWindowTheme(Handle, string.Empty, string.Empty);
base.OnHandleCreated(e);
}
}
Then it will appear like this (Font-size: 16):
Comparing to the default appearance: