开发者

is there a way to set the days and month names manually in a winform datetimepicker?

I want to set the days of a datetimepicker in english

but unfortunatly, the datetime picker don't support culture

so I think I can inherit the control, and s开发者_StackOverflowet the days and months name by myself

but I don't know how

anybody has an idea for that ?

thanks in advance

Sam


You can start with overriding OnPaint as outlined here: derived DateTimePicker

When you get to the part where you're setting the text, you can take out the reference to this.Text and put in your own string. Something like this:

     Thread.CurrentThread.CurrentCulture = 
                    CultureInfo.CreateSpecificCulture("en-US");
     string newlyFormattedText = this.Value.ToString("dddd, MMMM dd, yyyy");
     g.DrawString(newlyFormattedText, this.Font, Brushes.Black, 0, 2);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜