📄 u_singlesearch.pas
字号:
unit U_SingleSearch;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls;
type
TFm_SingleSearch = class(TForm)
Lbl_Caption: TLabel;
Edit_Value: TEdit;
Btn_Ok: TButton;
Btn_Cancel: TButton;
Bevel1: TBevel;
ChkBox_Blur: TCheckBox;
procedure Edit_ValueKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure Edit_ValueKeyPress(Sender: TObject; var Key: Char);
private
public
FMode: integer;
end;
function Show_SingleSearch(var pValue: string; var pBlur: Boolean; aMode: integer): Boolean;
implementation
uses
U_GlobalVar, U_GlobalProc;
{$R *.DFM}
function Show_SingleSearch(var pValue: string; var pBlur: Boolean; aMode: integer): Boolean;
var
Fm_SingleSearch: TFm_SingleSearch;
begin
Result := False;
Fm_SingleSearch := TFm_SingleSearch.Create(Application);
with Fm_SingleSearch do
try
FMode := aMode;
if aMode = 1 then
Lbl_Caption.Caption := Lbl_Caption.Caption + '姓名:'
else
begin
Lbl_Caption.Caption := Lbl_Caption.Caption + '学号:';
ChkBox_Blur.Enabled := False;
end;
if ShowModal = mrOk then
begin
pValue := Trim(Edit_Value.Text);
if (aMode = 2) and (Length(pValue) <= 4) then
pValue := S_SchoolCode + IntToStr(W_CurYear) +
IntFormatStr(StrToInt(pValue), 4);
pBlur := ChkBox_Blur.Checked;
Result := True;
end;
finally
Free;
end;
end;
procedure TFm_SingleSearch.Edit_ValueKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if (Key = VK_RETURN) then
begin
if Shift = [] then
SelectNext(ActiveControl, True, True)
else if Shift = [ssShift] then
SelectNext(ActiveControl, False, True);
Key := 0;
end;
end;
procedure TFm_SingleSearch.Edit_ValueKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
Key := #0;
if (FMode = 2) and (not (Key in ['0'..'9', #8, #0])) then
Key := #7;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -