如何在单击按钮时发送文本到日历的每个日期 [英] How to text to each date of calendar on button click

查看:56
本文介绍了如何在单击按钮时发送文本到日历的每个日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个显示月份明智的日历.
并在窗体上具有不同的按钮.
当用户单击按钮时,则在所选日期,与按钮相关的适当文本应显示在该日期下方.
怎么做.
请帮我实施.

我想在Windows形式的C#.net上实现.
预先感谢.

I want create calendar which show month wise.
And having Different buttons on Form.
When user will click on button then on selected date appropriate text related to button should display below that date.
How to do this.
Pls help me for implementation.

this I want to implement on Windows form of C#.net.
Thanks in advance.

推荐答案

Label someLabel = //...
Button timeButton = //...

//...

timeButton.Click += (sender, eventArgs) => {
    System.DateTime now = System.DateTime.Now;
    someLabel.Text = now.ToString(/* appropriate format specifier */);
};



格式说明符将帮助您以适当的顺序,以适当的区域性等显示日期.您可以使用其他参数来传递区域性,格式或同时传递两者.
请参阅:
http://msdn.microsoft.com/en-us/library/system.datetime.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/k494fzbf.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/ht77y576.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/zdtaw1bw.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/8tfzyc64.aspx [ ^ ].

对于IFormatProvider参数,可以使用CultureInfo(请参阅上面的文章参考中的代码示例).
所有格式说明符都分为标准"和自定义":
http://msdn.microsoft.com/en-us/library/az4se3k1.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx [ ^ ].

这就是您所需要的.

—SA



The format specifier will help you to present date along, in appropriate order, in appropriate culture, etc. You can use additional parameters to pass culture, format, or both.
Please see:
http://msdn.microsoft.com/en-us/library/system.datetime.aspx[^],
http://msdn.microsoft.com/en-us/library/k494fzbf.aspx[^],
http://msdn.microsoft.com/en-us/library/ht77y576.aspx[^],
http://msdn.microsoft.com/en-us/library/zdtaw1bw.aspx[^],
http://msdn.microsoft.com/en-us/library/8tfzyc64.aspx[^].

For IFormatProvider parameters, you can use CultureInfo (please see the code samples in the articles references above).
All format specifiers are classified into "standard" and "custom":
http://msdn.microsoft.com/en-us/library/az4se3k1.aspx[^],
http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx[^].

That''s all you need.

—SA


这篇关于如何在单击按钮时发送文本到日历的每个日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆