Delphi programming

xiaoxiao2021-03-06  43

// [1] I hope to press the Enter key, the up and down direction button instead of TAB in it back and forward procedure TFORM1.TAB (Sender: Tobject; var Key: Word; Shift: tshiftstate); begin (**) if (key = VK_Down) or (key = 13) then SelectNext (ActiveControl, True, True); if key = VK_Up then SelectNext (ActiveControl, False, True); Key: = 0; end; procedure TForm1.FormCreate (Sender: TObject); beginEdit_Name .Onkeydown: = Tab; edit_age.onkeydown: = Tab; Edit_adress.onkeydown: = Tab; End; // [2] Tissue some control objects (such as labels) and drag operations after selecting the control, to change control location procedure TForm1.Panel1MouseMove (Sender: TObject; Shift: TShiftState; X, Y: Integer); begin x_panel: = X; y_panel: = Y; end; procedure TForm1.Panel1DragOver (Sender, Source: TObject; X, Y: Integer State: TDRAGSTATE; VAR Accept: boolean; begin x_panel: = x; y_Panel: = Y; End; procedure tform1.label1mousemove (Sender: Tobject; Shift: tshiftstate; x, y: integer); recomgin x_panel: = x; Y_Panel: = Y; End; Procedure TFORM1.Label Lengthddrag (Sender, Target: Tobject; x, y: integer); begin label1.left: = x_panel-x_label; label1.top: = y_Panel-y_label; end; {[3] ==================== The string starts in the case statement ================================} function TFORM1.CASSTRING (Const S: string; const x: array s string): Integer Var i: integer; begin // (1) method results: = -1; // default return parameter for i: = low (x) to high (x) do beg IF s = x [i] the begin Result: BEGIN RESULT: = I; EXIT; End; end; // (2) method {const matchingstrings = '* first * second * third *'; var sstring: string; ... // sstring Has the data you want to test case POS '*' sstring '*'

, Matchingstrings) of 1: // In this case;} end; procedure tform1.button4click (sender: Tobject); var search, s: string; begin // (1) method uses Search: =' Delphi3000 '; Case CaseString (Search, [' delphi3000 ',' delphipages ',' torrys ']) of 0: s: =' Excellent! '; 1: s: =' good source '; 2: s: =' NOT Bad! '; end; showMessage (s); end; // [4] Get the phrase of the phrase of the Chinese characters, such as "Han" index letter is "H" function TFORM1.GETPYIDEXCHAR (Hzchar: String): char; Begin Case Word (Hzchar [1]) SHL 8 Word (Hzchar [2]) of $ B0A1. $ B0C4: Result: = 'A'; $ B0C5 .. $ B2C0: Result: = 'b'; $ B2C1 $ B4ed: result: = 'c'; $ b4ee .. $ b6e9: result: = 'd'; $ b6ea .. $ b7a1: result: = 'e'; $ b7a2 .. $ b8c0: result: = 'F'; $ b8c1 .. $ b9fd: result: = 'g'; $ b9fe .. $ bbf6: Result: = 'h'; $ bbf7 .. $ bfa5: result: = 'J'; $ bfa6 .. $ C0AB: Result: = 'k'; $ C0AC .. $ C2E7: Result: = 'L'; $ C2E8 .. $ C4C2: Result: = 'm'; $ C4C3 .. $ C5B5: Result: = 'N'; $ C5B6 .. $ C5BD: Result : = 'O'; $ C5BE .. $ c6d9: result: = 'p'; $ C6DA .. $ C8BA: Result: = 'q'; $ c8bb .. $ c8f5: result: = 'r'; $ c8f6 $ CBF9: Result: = 's'; $ CBFA .. $ cdd9: result: = 't'; $ cdda .. $ CEF3: Result: = 'W'; $ CEF4 .. $ d188: result: = 'X'

转载请注明原文地址:https://www.9cbs.com/read-59807.html

New Post(0)