简体   繁体   English

大日历的自定义控件

[英]custom control for large calendar

I'm starting from square one in trying to create a large calendar control. 我从第一方开始尝试创建一个大型日历控件。 Most likely to take up the whole screen or something. 最有可能占据整个屏幕或其他东西。 It doesn't need to complex, just navigate to dates and display a line of text on specific days. 它不需要复杂,只需导航到日期并在特定日期显示一行文本即可。

From researching this, sounds like I need to create my own custom control, which I have no idea how to do, moreover, how to achieve my objective. 通过研究,听起来好像我需要创建自己的自定义控件,而且我不知道该怎么做以及如何实现自己的目标。

Any insight? 有见识吗?

Just finished a similar project here, you'll want to use DataGridView as your control first of all. 刚刚在这里完成了一个类似的项目,您首先要使用DataGridView作为控件。 Then create functions to control the population of data based on what month/year it is, including extraneous variables like leap year, etc. 然后创建函数以根据数据的年/月来控制数据的填充,其中包括leap年等无关的变量。

So for a start, functions like: 因此,一开始,功能如下:

UpdateDaysInMonth(): Determine how many days for Jan,Feb,Mar, etc UpdateDaysInMonth():确定1月,2月,3月等的天数

UpdateMonth(): Did the user click next month or previous month? UpdateMonth():用户单击了下个月还是上个月?

UpdateColumns(): This will be based on your preference, my calendar had days 1-31 all the way across, but if you're looking for a more traditional looking calendar it would be setup differently. UpdateColumns():这将根据您的喜好而定,我的日历从头到尾都是1-31天,但是如果您要寻找的是更传统的日历,则设置会有所不同。 For the days Sun-Sat, use the HeaderText for columns. 对于星期日至星期六,请使用HeaderText作为列。

Once you have all the base data for what timeframe you're viewing, you can draw out the DataGridView. 获得了要查看的时间范围的所有基本数据后,就可以绘制出DataGridView。

Hope this helps, let me know if you have any more questions, and good luck! 希望这会有所帮助,如果您还有其他问题,请告诉我,祝您好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM