星期四, 1月 05, 2012

hint提示設定

Application.HintPause:=500;{延遲時間}
Application.HintColor:=$00CEF3E7;{提示的顏色}
Application.HintHidePause:=10000;{提示時間}
Application.HintShortPause:=100;{兩個提示中間的間隔}

檢測Shift、Alt和Ctrl鍵 & 滑鼠左鍵、中鍵、雙擊、右鍵

procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if Shift >= [ssShift] then
    label1.Caption := '你按下了Shift鍵';
  if Shift >= [ssAlt] then
    label1.Caption := '你按下了Alt鍵';
  if Shift >= [ssCtrl] then
    label1.Caption := '你按下了Ctrl鍵';
end;
 
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  if Shift >= [ssLeft] then
    label1.Caption := '你單擊鼠標左鍵';
  if Shift >= [ssMiddle] then
    label1.Caption := '你單擊鼠標中鍵';
  if Shift >= [ssDouble] then
    label1.Caption := '你雙擊了鼠標';
  if ssRight in Shift then
    label1.Caption := '你單擊鼠標右鍵';
end;