datetimepicker若是在得到焦點的時候自動定位到日期上,TDateTimePicker自動焦點定位到年,TDateTimePicker自動焦點定位到月,TDateTimePicker自動焦點

定位到月上程序

if key=vk_return then
begin
im

DTP1.SetFocus;移動

SendMessage(DTP1.Handle,WM_KEYDOWN,39,0);time

end;data

 

定位到日上return

if key=vk_return then
begin

DTP1.SetFocus;

SendMessage(DTP1.Handle,WM_KEYDOWN,39,0);

SendMessage(DTP1.Handle,WM_KEYDOWN,39,0);

end;

 

DTP1.SetFocus;

   SendMessage(DTP1.Handle,WM_KEYDOWN,VK_RIGHT,0);   SendMessage(DTP1.Handle,WM_KEYDOWN,VK_RIGHT,0)39是VK_RIGHT的虛擬鍵值。。通用的,就用上面這個,程序容易理解,就是把焦點移動到dataetimepicker上後,模擬光標vk_right被按下。

相關文章
相關標籤/搜索