1樓:失落的糖果
unit unit1;
inte***ce
uses
windows, messages, sysutils, variants, classes, graphics, controls, forms,
dialogs;
type
tform1 = class(tform)
procedure formcreate(sender: tobject);
procedure formdestroy(sender: tobject);
protected
procedure hotykey(var msg:tmessage); message wm_hotkey;
end;
varform1: tform1;
hotkey:integer;
implementation
procedure tform1.hotykey(var msg:tmessage);
begin
if (msg.lparamlo=mod_control) and (msg.lparamhi=13) then
begin
showmessage('你按了ctrl+enter');
end;
end;
procedure tform1.formcreate(sender: tobject);
begin
hotkey:=globaladdatom('hotkey');
registerhotkey(handle,hotkey,mod_control,13);
end;
procedure tform1.formdestroy(sender: tobject);
begin
unregisterhotkey(handle,hotkey);
end;
end.
delphi6 如何給button按鈕新增快捷鍵(回車)
2樓:匿名使用者
按鈕不能新增快捷鍵。但是你可以在button的caption字母前面加個 & 號,比如 確定(&s) ,這樣,按下alt+s鍵時,就會觸發這個button的click事件。
如果你想讓回車時觸發這個button的click事件的話,就得自己寫**了。比如在edit1的keydown裡寫上 if key = #13 then button1.click 等等,這樣,當你在edit1裡面填寫完東西后,按下回車,這個button的click就觸發了。
怎麼把飛秋髮送熱鍵改為ctrl+enter,回車換行習慣了,現在還得ctrl+enter換行,找遍整個設定也找不到
3樓:匿名使用者
不是在系統設定中,而是在「對話」的時候「傳送(s)」按鈕右側有個向下的箭頭,裡面有選擇
怎樣修改delphi的ctrl+space快捷鍵
4樓:匿名使用者
可以改的哦,用ide擴充套件就可以了,我給你發出部分**吧,臺灣人做的,
procedure register;
begin
(borlandideservices as
iotakeyboardservices).addkeyboardbinding(tbufferlist.create);
end;
procedure tbufferlist.bindkeyboard(const bindingservices:
iotakeybindingservices);
begin
bindingservices.addkeybinding([shortcut(ord('u'), [ssctrl])],
codecompletion, pointer(cscodelist or csmanual));
end;
procedure tbufferlist.codecompletion(const context: iotakeycontext;
keycode: tshortcut; var bindingresult: tkeybindingresult);
begin
(context.editbuffer.topview as
iotaeditactions).codecompletion(byte(context.context));
bindingresult := krhandled;
end;
呵呵,說句實話,從我開始穩定上網後,發現csdn的用處很有限,好像高手都不來這裡,好多資料也都找不到,然後論壇只見到好多菜鳥,悲哀,這還是中國最大的最專業的程式設計師**呢,當然csdn也有好多高手的哦.
做程式的英文要好.
大俠,delphi中想判斷ctrl+enter事件用什麼方法
5樓:浩大
//請參考procedure tform1.formkeydown(sender: tobject; var key:
word; shift: tshiftstate);begin case key of vk_return: if shift = then showmessage('ctrl+enter'); end;end;procedure tform1.
formcreate(sender: tobject);begin keypreview true;end; 檢視原帖》求採納
delphi中怎樣對alt+ctrl+del,win,tab等熱鍵的屏閉功能?請給出例項
6樓:匿名使用者
unit unit1;
inte***ceuses
windows, messages, sysutils, variants, classes, graphics, controls, forms,
dialogs,stdctrls,wintypes, winprocs,tlhelp32, extctrls;type
tform1 = class(tform)
btn1: tbutton;
btn2: tbutton;
edt1: tedit;
tmr1: ttimer;
//鍵盤上鎖
function disablekeyboard: boolean;
//鍵盤解鎖
procedure enablekeyboard;
procedure btn1click(sender: tobject);
procedure btn2click(sender: tobject);
procedure tmr1timer(sender: tobject);
private
public
end;var
form1: tform1;
hhk :hhook;
type
pkbdllhookstruct = ^kbdllhookstruct;
kbdllhookstruct = record
vkcode: dword;
scancode: dword;
flags: dword;
time: dword;
dwextrainfo: dword;
end;implementation
varoldhook: hhook;
function ycxsks( yc:boolean): boolean;stdcall; //隱藏-顯示任務條
varh:thandle;
begin
if yc = true then
begin
h:=findwindow('shell_traywnd',nil);
showwindow(h,sw_hide); //隱藏任務條
endelse
begin
h:=findwindow('shell_traywnd',nil);
showwindow(h,sw_show); //顯示任務條
end;
result:=true;
end;function keyhookproc(ncode: integer;wparam: wparam;lparam: lparam): lresult;stdcall;
//呼叫鍵盤鉤子,遮蔽左右win功能鍵
varp: pkbdllhookstruct;
y: integer;
begin
if ncode<0 then
result:= callnexthookex(hhk,ncode,wparam,lparam)
else
begin
y := 0;
case wparam of
wm_keydown,wm_syskeydown: //按鍵後判斷所按鍵
begin
p:=pkbdllhookstruct(lparam);
if p^.vkcode = vk_lwin then
y := 1;
if p^.vkcode = vk_rwin then
y := 1;
end;
wm_keyup,wm_syskeyup: //鬆開按鍵後判斷所按鍵
begin
p:=pkbdllhookstruct(lparam);
if p^.vkcode = vk_lwin then
y := 1;
if p^.vkcode = vk_rwin then
y := 1;
end;
end;
if y=1 then
result:=1 //如果為win功能鍵則遮蔽
else
result:= callnexthookex(hhk,ncode,wparam,lparam); //其他鍵放下一個鉤子
endend;function enablehide:boolean;stdcall;export; //外部呼叫
begin
if hhk = 0 then
begin
hhk := setwindowshookex(13,@keyhookproc,hinstance,0);
result := true;
endelse
result := false;
ycxsks(true);
end;function disablehide:boolean; stdcall; export; //外部呼叫
begin
if hhk <> 0 then
begin
unhookwindowshookex(hhk);
hhk := 0;
result := true;
endelse
result := false;
ycxsks(false);
end;function kbhook( code: integer; wparam: word; lparam: longint ): longint;
begin
if code < 0 then
kbhook := callnexthookex( oldhook, code, wparam, lparam )
else
kbhook := 1;
end; // kbhookfunction tform1.disablekeyboard: boolean;
//上鎖
begin
oldhook := setwindowshookex( wh_keyboard, @kbhook, hinstance, 0 );
disablekeyboard := oldhook <> 0;
end;procedure tform1.enablekeyboard;
//解鎖
begin
if oldhook <> 0 then
begin
unhookwindowshookex( oldhook );
oldhook := 0;
end; // if
end;
procedure tform1.btn1click(sender: tobject);
begin
enablehide;
disablekeyboard;
tmr1.enabled:=true;
end;procedure tform1.btn2click(sender: tobject);
begin
disablehide;
enablekeyboard;
tmr1.enabled:=false;
end;
procedure tform1.tmr1timer(sender: tobject);
varhwnd:thandle;
begin
hwnd:=findwindow(nil,pchar('windows 工作管理員'));
if hwnd<>0 then
sendmessage(hwnd,wm_close,0,0);
end;
end.
編譯通過的~
在delphi中怎麼設定介面的背景
delphi設定介面背景有兩種情況,一是在設計期間修改背景,二是在執行期間修改。對於設計期的修改方法如下 1.選擇待處理的form 2.在屬性編輯中,找到color屬性 3.使用下拉選擇待設定的顏色 4.逐一設定視窗上所有的控制元件,將其控制元件的transparent屬性修改為true,以使得字型...
delphi中如何註冊oc檔案,delphi 中 如何註冊ocx檔案
如果是想加一個delphi中的話,啟動delphi後,關閉所有工程,選擇component選單,再選擇import activex control 就會出來介面,再選擇add,選擇你要裝的ocx,再按install 首先建立一個新的vcl工程用於測試 方法大家都會 現在開始安裝ocx控制元件,方法有...
在delphi中的datagrid怎樣使它顯示的行間隔改變顏色
在 delphi 的內建元件裡,並沒有 datagrid 元件。以下提供的是 dbgrid 元件,隔行變色顯示的 procedure tform1.dbgrid1drawdatacell sender tobject const rect trect field tfield state tgrid...