keydown or keypress 里处理就行啦, 如果不符合即 exit第二个问题, 取得些月第一天和最后一天, 循环加7就是了...
1、 onKeyPress中: if not (Key in ['2','3',#8]) then Key := #0; 2、 2-1:某日期有几个星期use DateUtils; //function WeekOfTheMonth(const AValue: TDateTime): Word; overload; var iWeekCount: integer; begin iWeekCount := WeekOfTheMonth(Now); //某日期的月的周数2-2:以周日作为起始日期呢,还是以周一??
onKeyPress中:
if not (Key in ['2','3',#8]) then Key := #0;
2、
2-1:某日期有几个星期use DateUtils;
//function WeekOfTheMonth(const AValue: TDateTime): Word; overload;
var
iWeekCount: integer;
begin
iWeekCount := WeekOfTheMonth(Now); //某日期的月的周数2-2:以周日作为起始日期呢,还是以周一??
2、iWeekCount := WeekOfTheMonth(Now); //某日期的月的周数
第二个请参考DateUtils这个单元,应该可以满足你的要求。