We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How can I change the width of the DateTimePickerAdv when it is in standard format?

Platform: WinForms |
Control: DateTimePickerAdv |
Published Date: April 30, 2011 |
Last Revised Date: July 10, 2014


It is possible to adjust the width of the DateTimePickerAdv when it is in standard format. The width of the DateTimePickerAdv is calculated by adding the following constraints:

  • Width of the DateTimePickerUpDownButton
  • Width of the DateTimePickerDropButton
  • Font size of the DateTimePickerAdv
  • The length of the DataTimePickerAdv's Value in the specified standard format.


//New font size is set here.

this.dateTimePickerAdv1.Font = new Font("Tahoma", 13);

this.dateTimePickerAdv1.ShowCheckBox = false;

this.dateTimePickerAdv1.ShowUpDown = true;

this.dateTimePickerAdv1.AutoSize = false;

this.dateTimePickerAdv1.AutoSizeMode = AutoSizeMode.GrowOnly;

this.dateTimePickerAdv1.Format = DateTimePickerFormat.Long;

int updownWidth = 0, dropWidth = 0;

//Calculating the UpDown and DropDown button width

foreach (Control ctrl in this.dateTimePickerAdv1.Controls)


if (ctrl.GetType().ToString() == "Syncfusion.Windows.Forms.Tools.DateTimePickerUpDownButton")

updownWidth = ctrl.Size.Width;

else if (ctrl.GetType().ToString() == "Syncfusion.Windows.Forms.Tools.DateTimePickerDropButton")

dropWidth = ctrl.Size.Width;


//Sum up the width of drop down button, updown button and font.

int nWidth = dropWidth + updownWidth + Convert.ToInt32(this.dateTimePickerAdv1.Font.Size * this.dateTimePickerAdv1.Value.ToLongDateString().Length);

this.dateTimePickerAdv1.Width = nWidth;


''Font is set

Me.DateTimePickerAdv2.Font = New Font("Tahoma", 13)

Me.DateTimePickerAdv2.ShowCheckBox = False

Me.DateTimePickerAdv2.ShowUpDown = True

Me.DateTimePickerAdv2.AutoSize = False

Me.DateTimePickerAdv2.AutoSizeMode = Windows.Forms.AutoSizeMode.GrowOnly

Me.DateTimePickerAdv2.Format = DateTimePickerFormat.Long

Dim updownWidth As Integer = 0, dropWidth As Integer = 0

''Calculating the UpDown and DropDown button width

For Each ctrl As Control In Me.DateTimePickerAdv2.Controls

If ctrl.GetType().ToString() = "Syncfusion.Windows.Forms.Tools.DateTimePickerUpDownButton" Then

updownWidth = ctrl.Size.Width

ElseIf ctrl.GetType().ToString() = "Syncfusion.Windows.Forms.Tools.DateTimePickerDropButton" Then

dropWidth = ctrl.Size.Width

End If

Next ctrl

''Sum up the width of drop down button, updown button and font.

Dim nWidth As Integer = dropWidth + updownWidth + Convert.ToInt32(Me.DateTimePickerAdv2.Font.Size * Me.DateTimePickerAdv2.Value.ToLongDateString().Length)

Me.DateTimePickerAdv2.Width = nWidth



2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon