用delphi很多年了,一直对一些小技巧都不知道,希望大家把各自知道的一些技巧贴出来,大家共享一下!谢谢大伙了!
还有就是一些大家常用的编程风格,例如匈牙利编程风格!
大家多帮忙不要让这个贴子沉下去啊!
还有就是一些大家常用的编程风格,例如匈牙利编程风格!
大家多帮忙不要让这个贴子沉下去啊!
解决方案 »
- 怎么让公司和家里的代码同步?
- 当鼠标停留在一个图片上时,怎么得到这个图片的URL?
- dbgrid 小问题,请大家帮忙!谢谢
- 有哪位仁兄知道怎么读写.db文件
- 系统提示:[Fatal Error]Procect1.dpr(1):File Not find :'System.pas',应该怎么处理??
- 关于主窗体的问题
- 请问使用 IDPOP3 怎么样得到附件名称,大小,又该如何下载下来?
- 请教一个实现翻动日历的问题
- 大家一起来讨论和学习DELPHI,软件开发方面。我在软年公司工作,有意者和我联系QQ:191486648
- 怪事:我的事务处理程序为什么执行时成功了一半?请专家诊断!
- 比较菜的问题!在 richedit 中的居中对齐命令是什么?
- 数据类型转换,请教谢谢
CTRL+C复制
CTRL+V粘贴
CTRL+X剪切
shitf+箭头选择
如果按住Alt,再进行选择,则是一种区域选择,而不是行选择,粘贴的时候也就是插入粘贴了.
F9运行
F8STEPOVER
F7TRACEINTO
F11,F12切换EDITOR,INSPECTOR,FORMDESIGNER.
CTRL+ALT+F11弹出工程管理器象这些都是菜单中有的快捷方式,其它的您可以自己去找,就不无聊了,下面是一些不是很容易找到(或者比较容易忘记的快捷操作)的快捷操作:
PB的SHITF+TAB好象很酷,其实DELPHI也有.
另外就是在PB中,如果你对选择的代码使用TAB键,就是所有的选择向后跳格,但是DELPHI中怎样跳格呢?其实也是有办法的,就是CTRL+K,I向后,CTRL+K,U向前.
如果你是在接口函数的实现部分,那么CTRL+SHIFT+上箭头就可以到声明部分.同样再CTRL+SHIFT+下箭头又回到实现部分是不是觉得DELPHI好象没有标签功能,CTRL+SHIFT+数字定义标签(当然因为数据键只有10个,所以您也只能定义从0~9的10个标签),CTRL+数字就是定位到相应的标签的位置.
有时候反复输入什么东西是不是很繁?CTRL+SHIFT+R录制键盘宏,比如我经常做的就是:下箭头-下箭头-HOME-回车-CTRL+V,再键入一次CTRL+SHIFT+R录制完成,之后您可以使用CTRL+SHIFT+P,重复宏,还是省了一些事的.另外还有一些快捷都是很少用到的,我也想不起来,您要是有兴趣就在帮助索引中输入”Classickeystrokemapping”,自己看吧.
Ctrl + <-- 移動光標到一個單詞的前或後。
先选中几行代码试试
难到大家没觉得用mouse很烦吗?
These clipboard keyboard shortcuts apply to the Default keystroke mapping scheme.Shortcut CommandCtrl+Ins Edit|Copy
Shift+Del Edit|Cut
Shift+Ins Edit|PasteCtrl+C Edit|Copy
Ctrl+V Edit|Paste
Ctrl+X Edit|CutBreakpoint viewCtrl+V View Source
Ctrl+S Edit Source
Ctrl+E Edit Breakpoint
Enter Edit Breakpoint
Ctrl+D Delete Breakpoint
Del Delete Breakpoint
Ctrl+A Add Breakpoint
Ins Add Breakpoint
Ctrl+N Enable BreakpointCall stack viewCtrl+V View Source
Ctrl+E Edit Source
Space View Source (Epsilon only)
Ctrl+Enter Edit Source (Epsilon only)Message viewCtrl+V View Source
Space View Source
Ctrl+S Edit Source
Ctrl+Enter Edit SourceWatch viewCtrl+E Edit Watch
Enter Edit Watch
Ctrl+A Add Watch
Ins Add Watch
Ctrl+D Delete Watch
Del Delete Watch
F1 Help|Topic Search
Ctrl+F1 Help|Topic Search
F3 Search|Search AgainCtrl+E Search|Incremental Search
Ctrl+F Search|Find
Ctrl+I Inserts a tab character
Ctrl+j Templates pop-up menu
Ctrl+N Inserts a new line
Ctrl+P Causes next character to be interpreted as an ASCII sequence
Ctrl+R Search|Replace
Ctrl+S File|Save
Ctrl+T Deletes a wordCtrl+Y Deletes a line
Ctrl+Z Edit|Undo
Ctrl+<space bar> Code Completion pop-up windowCtrl+Shift+g Inserts a new Globally Unique Identifier (GUID)
Ctrl+Shift+I Indents block
Ctrl+Shift+U Outdents block
Ctrl+Shift+Y Deletes to the end of a line
Ctrl+Shift+Z Edit|Redo
Ctrl+Shift+<space bar> Code Parameters pop-up windowAlt+[ Finds the matching delimiter (forward)
Alt+] Finds the matching delimiter (backward)End Moves to the end of a line
Home Moves to the start of a lineEnter Inserts a carriage return
Ins Turns insert mode on/off
Del Deletes the character to the right of the cursor
Backspace Deletes the character to the left of the cursor
Tab Inserts a tab
Space Inserts a blank space
Left Arrow Moves the cursor left one column, accounting for the autoindent setting
Right Arrow Moves the cursor right one column, accounting for the autoindent setting
Up Arrow Moves up one lineDown Arrow Moves down one line
Page Up Moves up one page
Page Down Moves down one page
Ctrl+Right Arrow Moves one word right
Ctrl+Tab Moves to the next code page (or file)
Ctrl+Shift+Tab Moves to the previous code page (or file)
Ctrl+Backspace Deletes the word to the right of the cursor
Ctrl+Home Moves to the top of a file
Ctrl+End Moves to the end of a fileCtrl+Del Deletes a currently selected block
Ctrl+Space Inserts a blank space
Ctrl+PgDn Moves to the bottom of a screen
Ctrl+PgUp Moves to the top of a screen
Ctrl+Up Arrow Scrolls up one line
Ctrl+Down Arrow Scrolls down one line
Ctrl+Enter Opens file at cursorShift+Tab Moves the cursor to the left one tab position
Shift+Backspace Deletes the character to the left of the cursor
Shift+Left Arrow Selects the character to the left of the cursorShift+Right Arrow Selects the character to the right of the cursor
Shift+Up Arrow Moves the cursor up one line and selects from the left of the starting cursor position
Shift+Down Arrow Moves the cursor down one line and selects from the right of the starting cursor position
Shift+PgUp Moves the cursor up one screen and selects from the left of the starting cursor position
Shift+PgDn Moves the cursor down one line and selects from the right of the starting cursor positionShift+End Selects from the cursor position to the end of the current line
Shift+Home Selects from the cursor position to the start of the current line
Shift+Space Inserts a blank space
Shift+Enter Inserts a new line with a carriage returnCtrl+Shift+Left Arrow Selects the word to the left of the cursor
Ctrl+Shift+Right Arrow Selects the word to the right of the cursor
Ctrl+Shift+Home Selects from the cursor position to the start of the current fileCtrl+Shift+End Selects from the cursor position to the end of the current file
Ctrl+Shift+PgDn Selects from the cursor position to the bottom of the screen
Ctrl+Shift+PgUp Selects from the cursor position to the top of the screen
Ctrl+Shift+Tab Moves to the previous page
Shift+Alt+arrow Selects column-oriented blocks
Click+Alt+mousemove Selects column-oriented blocks
Ctrl+O+C Turns on column blocking
Ctrl+O+K Turns off column blockingAlt+Backspace Edit|Undo
Alt+Shift+Backspace Edit|Redo
Alt+Shift+Left Arrow Selects the column to the left of the cursor
Alt+Shift+Right Arrow Selects the column to the right of the cursor
Alt+Shift+Up Arrow Moves the cursor up one line and selects the column from the left of the starting cursor position
Alt+Shift+Down Arrow Moves the cursor down one line and selects the column from the left of the starting cursor positionAlt+Shift+Page Up Moves the cursor up one screen and selects the column from the left of the starting cursor position
Alt+Shift+Page Down Moves the cursor down one line and selects the column from the right of the starting cursor position
Alt+Shift+End Selects the column from the cursor position to the end of the current line
Alt+Shift+Home Selects the column from the cursor position to the start of the current lineCtrl+Alt+Shift+Left Arrow Selects the column to the left of the cursorCtrl+Alt+Shift+Right Arrow Selects the column to the right of the cursor
Ctrl+Alt+Shift+Home Selects the column from the cursor position to the start of the current file
Ctrl+Alt+Shift+End Selects the column from the cursor position to the end of the current file
Ctrl+Alt+Shift+Page Up Selects the column from the cursor position to the bottom of the screen
Ctrl+Alt+Shift+Page Down Selects the column from the cursor position to the top of the screen
Ctrl+K+B Marks the beginning of a block
Ctrl+K+C Copies a selected block
Ctrl+K+H Hides/shows a selected block
Ctrl+K+I Indents a block by the amount specified in the Block Indent combo box on the General page of the Editor Options dialog box.
Ctrl+K+K Marks the end of a block
Ctrl+K+L Marks the current line as a block
Ctrl+K+N Changes a block to uppercase
Ctrl+K+O Changes a block to lowercaseCtrl+K+P Prints selected block
Ctrl+K+R Reads a block from a file
Ctrl+K+T Marks a word as a block
Ctrl+K+U Outdents a block by the amount specified in the Block Indent combo box on the General page of the Editor Options dialog box.
Ctrl+K+V Moves a selected block
Ctrl+K+W Writes a selected block to a file
Ctrl+K+Y Deletes a selected blockCtrl+O+C Turns on column blocking
Ctrl+O+I Marks an inclusive blockCtrl+O+K Turns off column blocking
Ctrl+O+L Marks a line as a blockShift+Alt+arrow Selects column-oriented blocks
Click+Alt+mousemv Selects column-oriented blocksCtrl+Q+B Moves to the beginning of a block
Ctrl+Q+K Moves to the end of a blockCtrl+K+0 Sets book 0
Ctrl+K+1 Sets book 1
Ctrl+K+2 Sets book 2
Ctrl+K+3 Sets book 3
Ctrl+K+4 Sets book 4
Ctrl+K+5 Sets book 5
Ctrl+K+6 Sets book 6
Ctrl+K+7 Sets book 7
Ctrl+K+8 Sets book 8
Ctrl+K+9 Sets book 9Ctrl+K+Ctrl+0 Sets book 0
Ctrl+K+Ctrl+1 Sets book 1
Ctrl+K+Ctrl+2 Sets book 2Ctrl+K+Ctrl+3 Sets book 3
Ctrl+K+Ctrl+4 Sets book 4
Ctrl+K+Ctrl+5 Sets book 5
Ctrl+K+Ctrl+6 Sets book 6
Ctrl+K+Ctrl+7 Sets book 7
Ctrl+K+Ctrl+8 Sets book 8
Ctrl+K+Ctrl+9 Sets book 9
Ctrl+Q+1 Goes to book 1
Ctrl+Q+2 Goes to book 2
Ctrl+Q+3 Goes to book 3
Ctrl+Q+4 Goes to book 4
Ctrl+Q+5 Goes to book 5Ctrl+Q+6 Goes to book 6
Ctrl+Q+7 Goes to book 7
Ctrl+Q+8 Goes to book 8
Ctrl+Q+9 Goes to book 9Ctrl+Q+Ctrl+0 Goes to book 0
Ctrl+Q+Ctrl+1 Goes to book 1
Ctrl+Q+Ctrl+2 Goes to book 2
Ctrl+Q+Ctrl+3 Goes to book 3
Ctrl+Q+Ctrl+4 Goes to book 4
Ctrl+Q+Ctrl+5 Goes to book 5
Ctrl+Q+Ctrl+6 Goes to book 6
Ctrl+Q+Ctrl+7 Goes to book 7Ctrl+Q+Ctrl+8 Goes to book 8
Ctrl+Q+Ctrl+9 Goes to book 9The following shortcuts apply only to the Default, Visual Studio, and Visual Basic schemes:Shortcut ActionShift+Ctrl+0 Sets book 0
Shift+Ctrl+1 Sets book 1
Shift+Ctrl+2 Sets book 2
Shift+Ctrl+3 Sets book 3
Shift+Ctrl+4 Sets book 4
Shift+Ctrl+5 Sets book 5
Shift+Ctrl+6 Sets book 6
Shift+Ctrl+7 Sets book 7
Shift+Ctrl+8 Sets book 8
Shift+Ctrl+9 Sets book 9Ctrl+0 Goes to book 0
Ctrl+1 Goes to book 1
Ctrl+2 Goes to book 2Ctrl+3 Goes to book 3
Ctrl+4 Goes to book 4
Ctrl+5 Goes to book 5
Ctrl+6 Goes to book 6
Ctrl+7 Goes to book 7
Ctrl+8 Goes to book 8
Ctrl+9 Goes to book 9Ctrl+Q+B Moves to the beginning of a block
Ctrl+Q+C Moves to end of a file
Ctrl+Q+D Moves to the end of a line
Ctrl+Q+E Moves to the top of the window
Ctrl+Q+K Moves to the end of a block
Ctrl+Q+P Moves to previous position
Ctrl+Q+R Moves to the beginning of a file
Ctrl+Q+S Moves to the beginning of a line
Ctrl+Q+T Moves to the top of the window
Ctrl+Q+U Moves to the bottom of the windowCtrl+Q+X Moves to the bottom of the windowCtrl+K+D Accesses the menu bar
Ctrl+K+E Changes a word to lowercase
Ctrl+K+F Changes a word to uppercase
Ctrl+K+S File|Save (Default and IDE Classic only)Ctrl+Q+A Search|Replace
Ctrl+Q+F Search|Find
Ctrl+Q+Y Deletes to the end of a line
Ctrl+Q+[ Finds the matching delimiter (forward)
Ctrl+Q+Ctrl+[ Finds the matching delimiter (forward)
Ctrl+Q+] Finds the matching delimiter (backward)Ctrl+Q+Ctrl+] Finds the matching delimiter (backward)Ctrl+O+A Open file at cursor
Ctrl+O+B Browse symbol at cursor
Alt+right arrow For code browsing
Alt +left arrow For code browsing
Ctrl+O+G Search|Go to line number
Ctrl+O+O Inserts compiler options and directives
Ctrl+O+U Toggles case
Navigate quickly through your unit files by pressing Ctrl+Shift and the arrow keys.Place the cursor on the prototype of any method or global procedure in the interface section of a unit. Then press Ctrl+Shift+Up Arrow or Ctrl+Shift+Down Arrow to move to the procedure抯 implementation.
Press Ctrl+Shift+Up Arrow or Ctrl+Shift+Down Arrow to toggle between the interface and implementation sections.You can also set your own books by right-clicking in the Code editor and choosing Toggle Books. To jump to a book, right-click and choose Goto Books.F1 Displays context-sensitive Help
F4 Run|Go to Cursor
F5 Run|Toggle Breakpoint
F7 Run|Trace Into
F8 Run|Step Over
F9 Run|Run
F11 View|Object Inspector
F12 View|Toggle Form/Unit
Alt+0 View|Window List
Alt+F2 View|Debug Windows|CPU
Alt+F7 Displays previous error in Message view
Alt+F8 Displays next error in Message view
Alt+F10 Displays a context menu
Alt+F11 File|Use Unit
Alt+F12 Displays the Code editorAlt+right arrow For code browsing forward
Alt+left arrow For code browsing backward
Alt+up arrow For code browsing Ctrl-click on identifier
Shift+Alt+arrow Selects column-oriented blocks
Click+Alt+mousemv Selects column-oriented blocks
Ctrl+O+C Turns on column blocking
Ctrl+O+K Turns off column blockingCtrl+F1 Help|Topic Search
Ctrl+F2 Run|Program Reset
Ctrl+F3 View|Debug Windows|Call Stack
Ctrl+F4 Closes current file
Ctrl+F5 Add Watch at CursorCtrl+F6 Displays header file in Code editorCtrl+F7 Evaluate/Modify
Ctrl+F9 Project|Compile projectCtrl+F11 File|Open ProjectCtrl+F12 View|Units
Ctrl+D Descends item (replaces Inspector window)
Ctrl+E View|Code Explorer
Ctrl+N Opens a new Inspector window
Ctrl+S Incremental search
Ctrl+T Displays the Type Cast dialogShift+F7 Run|Trace To Next Source Line
Shift+F11 Project|Add To Project
Shift+F12 View|FormsCtrl+Shift+P Plays back a key macro
Ctrl+Shift+R Records a key macroCtrl+K+D Accesses the menu bar
Ctrl+K+S File|Save
1.SHIFT+游標左鍵 先選中任一元件,按鍵後可選中視窗(選中元件後按Esc效果一樣)
2.Shift+F8 調試時彈出CPU視窗。
3.Shift+F10 等於游標右鍵(Windows快捷鍵)。
4.Shitf+箭頭 選擇
5.shift +F12 快速查找視窗並打開
6.F7 (步進式調試同時追蹤進入子過程)
7.F8 (步進式調試不進入子過程)
8.F9 執行
9.F12 切換EDITOR,FORM
10.Alt+F4 關閉所有編輯框中打開的源程序文件,但不關閉項目
11.ALT+游標左鍵 可以塊選程式碼,用來刪除對齊的重複程式碼非常有用
12.Ctrl+F9 編譯
13.Ctrl+shift+N(n=1,2,3,4......) 定義書籤
14.Ctrl+n(n=1,2,3,4......)跳到書籤n
15.CTRL +SHIFT+N 在書籤N處,再按一次 取消書籤
16.Ctrl+PageUp 將游標移至本屏的第一行,螢幕不滾動
17.Ctrl+PageDown 將游標移至本屏的最後一行,螢幕不滾動
18.Ctrl+↓ 向下滾動螢幕,游標跟隨滾動不出本屏
19.Ctrl+↑ 向上滾動螢幕,游標跟隨滾動不出本屏
20.Ctrl+Home 將游標移至文件頭
21.Ctrl+End 將游標移至文件尾
22.Ctrl+B Buffer List視窗
23.Ctrl+I 同Tab鍵
24.CTRL+J (彈出Delphi語句提示視窗,選擇所需語句將自動完成一條語句)程式碼模板
25.Ctrl+M 同Enter鍵。
26.Ctrl+N 同Enter鍵,但游標位置保持不變
27.Ctrl+T 刪除游標右邊的一個單詞
28.Ctrl+Y 刪除游標所在行
29.CTRL+C 複製
30.CTRL+V 貼上
31.CTRL+X 剪切
32.CTRL+Z 還原(Undo)
33.CTRL+S 保存
34.Ctrl+F 查找
35.Ctrl+L 繼續查找
36.Ctrl+r 替換
37.CTRL+ENTER 定位到單元文件
38.Ctrl+F3 彈出Call Stack視窗
39.Ctrl+F4 等於File選單中的Close項
40.Ctrl+Backspace 後退刪除一個詞,直到遇到一個分割符
41.Ctrl+游標轉輪 加速滾屏
42.Ctrl+O+U 切換選擇塊的大小寫(注意鬆開O後再按U,Ctrl保持按下)
43.Ctrl+K+O 切換選擇塊為小寫(注意鬆開K後再按O,Ctrl保持按下)
44.Ctrl+K+N 切換選擇塊為大寫(注意鬆開K後再按N,Ctrl保持按下)
45.Ctrl+Shift+G 插入GUID
46.Ctrl+Shift+T 在游標行加入To-Do註釋
47.Ctrl+Shift+Y 刪除游標之後至本行末尾之間的文本
48.CTRL+SHIFT+C 編寫申明或者補上函數,絕好!!!
49.CTRL+SHIFT+E 顯示EXPLORER
50.Ctrl+Tab 在Inspector中切換Properties頁和Events頁
51.CTRL+SHIFT+U 程式碼整塊左移2個空格位置
52.CTRL+SHIFT+I 程式碼整塊右移2個空格位置
53.CTRL+SHIFT+↑ 在過程、函數、事件內部, 可跳躍到相應的過程、函數、事
件的定義(在interface和implementation之間來回切換)
54.CTRL+SHIFT+↓ 在過程、函數、事件的定義處, 可跳躍到具體過程、函數、事件內部(同上)
55.Tab 在object inspector視窗按tab鍵將游標移動到屬性名區,然後鍵入屬性名的開頭
字母可快速定位到該屬性
56.Ctrl+Alt 按著Ctrl+Alt之後,可用游標選擇一個矩形塊中的程式碼,
並可比它進行複製,貼上
57.Shift+↓、↑、→、← 以1像素單位更改所選元件大小
58.Ctrl+↓、↑、→、←以1像素單位更改所選元件位置
59.Ctrl+E 快速選擇(呵呵,試試吧,很好玩的)
一般我們在Debug時, 最常用中斷點 or Evaluate/Modify,
可是有時候不小心F7/F8按得太快, 不知道這個功能只好重新執行,
其實這是可以時光倒轉的,
1. 當執行到中斷點時, 發現數值有問題...
2. 按 Ctrl + Alt + C 進入CPU .
3. 觀察CPU左上方視窗, 可以看到中斷點的程式碼與組語. Ex: Unit1.cpp.21
4. 用滑鼠選擇到 Unit.cpp.20, 按下Ctrl + N 會發現程式往前回朔至Unit.cpp.20了...
写delphi程序, 千万不要用记事本写,我用的是Delphi自己的IDE, 真的很好用!真的!!!或者:用ultraEdit也行.