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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

DateTimePicker forecolor query

Thread ID:

Created:

Updated:

Platform:

Replies:

50551 Oct 13,2006 05:29 PM UTC Oct 18,2006 05:14 PM UTC WinForms 7
loading
Tags: Tools
Abhilash N
Asked On October 13, 2006 05:29 PM UTC

Hi,
I want to know how to change forecolor of the text
in the DateTimePickerAdv control so that in
the disable mode also i can see the text
color of the date is black.

Thanks

Saradha [Syncfusion]
Replied On October 14, 2006 02:23 PM UTC

Hi Abhilash,

When you disable the dateTimePickerAdv, the textColor of the dateTimePickerAdv will also be disabled. It will not display the text color as same as when the control is enabled. You can achieve both the same forecolor and the disabled behaviour by setting the ReadOnly property of dateTimePickerAdv as true. This will display the text color as it is when the control's ReadOnly is false. Please refer to the attached sample.
Sample.zip

Please let me if you have any questions. Thanks for using Syncfusion products.

Regards,
K.Saradha Devi.

Abhilash N
Replied On October 14, 2006 05:56 PM UTC

Hi again,
Thanks for the response and the sample as well.I got just one more question like i did for other normal window controls like Textbox -
I overrided the onpaint method and wrote a code to drawstring in black and it worked fine.But specifically DateTimepicker i inherited from the Syncfusion the same thing i tried with that also but not worked.
So it means only option is to make it Readonly than.






>Hi Abhilash,

When you disable the dateTimePickerAdv, the textColor of the dateTimePickerAdv will also be disabled. It will not display the text color as same as when the control is enabled. You can achieve both the same forecolor and the disabled behaviour by setting the ReadOnly property of dateTimePickerAdv as true. This will display the text color as it is when the control's ReadOnly is false. Please refer to the attached sample.
Sample.zip

Please let me if you have any questions. Thanks for using Syncfusion products.

Regards,
K.Saradha Devi.

Saradha [Syncfusion]
Replied On October 16, 2006 10:07 AM UTC

Hi Abhilash,

Readonly is not the only option to fulfill your requirement. As you said, You can override the OnPaint method to set the string inside the DateTimePicker. Please refer the attached sample.
Sample.zip

Please let me know if this works for you. Thanks for using Syncfusion products.

Regards,
K.Saradha Devi,

Abhilash N
Replied On October 16, 2006 09:20 PM UTC

It works fine except it shows the string (text) at the back of the overrided one so it is
like one over the other,adjusting the text also is not letting me to place
it exactly over the other one.
Not sure why from the back the disabled text version is visible behind the
overrided one which is black in color.

Thanks


>Hi Abhilash,

Readonly is not the only option to fulfill your requirement. As you said, You can override the OnPaint method to set the string inside the DateTimePicker. Please refer the attached sample.
Sample.zip

Please let me know if this works for you. Thanks for using Syncfusion products.

Regards,
K.Saradha Devi,

Saradha [Syncfusion]
Replied On October 17, 2006 04:38 AM UTC

Hi Abhilash,

To make the default text invisible, you should set the Format property of the DateTimePickerAdv as custom.You can do this in the designer or add the below given code snippet in the overridden OnPaint method.

"this.Format=System.Windows.Forms.DateTimePickerFormat.Custom;"

Please let me know if I have misunderstood anything. Thanks for using Syncfusion products.

Regards,
K.Saradha Devi.

Abhilash N
Replied On October 17, 2006 05:30 AM UTC

Hi again,
Thanks for your timely response and very clear explaination.Actually i did set the custom property but like during the Onpaint method overriding as your sample code says to set it.
Is there any other place i need to set this property.
After using the approach which you told it gives black color but yaah i want to know where to set the format property as i already set it as mentioned in your code which you have sent.

Abhilash

>Hi Abhilash,

To make the default text invisible, you should set the Format property of the DateTimePickerAdv as custom.You can do this in the designer or add the below given code snippet in the overridden OnPaint method.

"this.Format=System.Windows.Forms.DateTimePickerFormat.Custom;"

Please let me know if I have misunderstood anything. Thanks for using Syncfusion products.

Regards,
K.Saradha Devi.

Abhilash N
Replied On October 18, 2006 05:14 PM UTC


Hi ,

It works fine now.Thanks.Can i use same from
MaskEditorTextBox control?

Please do reply.

Abhilash
>Hi again,
Thanks for your timely response and very clear explaination.Actually i did set the custom property but like during the Onpaint method overriding as your sample code says to set it.
Is there any other place i need to set this property.
After using the approach which you told it gives black color but yaah i want to know where to set the format property as i already set it as mentioned in your code which you have sent.

Abhilash

>Hi Abhilash,

To make the default text invisible, you should set the Format property of the DateTimePickerAdv as custom.You can do this in the designer or add the below given code snippet in the overridden OnPaint method.

"this.Format=System.Windows.Forms.DateTimePickerFormat.Custom;"

Please let me know if I have misunderstood anything. Thanks for using Syncfusion products.

Regards,
K.Saradha Devi.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

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

;