在窗体上放一个ApplicationEvents控件,然后再onmessage中处理,如下面:procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG; var Handled: Boolean); begin if (Msg.message = wm_char) then //key press begin if (Msg.wParam = 45) then //'-'鍵 begin TrackBar1.Position := TrackBar1.Position-1; end else if (Msg.wParam = 43) or (Msg.wParam = 61) then //'+'鍵 大键盘61,小键盘43 begin TrackBar1.Position := TrackBar1.Position+1; end; end; end;不好意思,因为一时不知道'+'鍵的虚拟键代码,只好直接用数字表示。 thanks
var Handled: Boolean);
begin if (Msg.message = wm_char) then //key press
begin
if (Msg.wParam = 45) then //'-'鍵
begin
TrackBar1.Position := TrackBar1.Position-1;
end
else if (Msg.wParam = 43) or (Msg.wParam = 61) then //'+'鍵 大键盘61,小键盘43
begin
TrackBar1.Position := TrackBar1.Position+1;
end; end;
end;不好意思,因为一时不知道'+'鍵的虚拟键代码,只好直接用数字表示。
thanks