Delphi 기술 집합

4062 단어 Delphi
시스템
1. 다른 프로그램, 파일을 여는 방법:
     uses ShellAPI;

    ShellExecute(Application.Handle, nil, PChar(FilePath), nil, nil, SW_SHOWNORMAL);

2. 파일 또는 폴더 디렉토리를 찾습니다.
     uses ShellAPI;

    ShellExecute(Application.Handle, nil, PChar('explorer.exe'),PChar('/e, '+ '/select,' + FilePath), nil, SW_NORMAL);

 
다른
1. 숫자만 입력할 수 있도록 제한
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
    if not (key in ['0'..'9',#8,#13]) then
        key:=#0;
end;

2, N 분 전 시간
var
    pDate:TDate;
    NowTime:String;
begin
    pDate:=now();
    pDate:=pDate-10/24/60;   //10     
    NowTime:=FormatDateTime('yyyy-mm-dd hh:mm:ss',pDate);
end;

3, StringGrid 오른쪽 클릭 선택 테이블
procedure TFGLGL.StringGrid1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var
    MousePos:   TSmallPoint;
begin
    if   Button   =   mbRight   then
    begin
        MousePos.x   :=   x;
        MousePos.y   :=   y;
        SendMessage(StringGrid1.Handle, WM_LBUTTONDOWN, 0, MAKELONG(x, y));
        SendMessage(StringGrid1.Handle, WM_LBUTTONUP, 0, MAKELONG(x, y));
    end;
end;

 

좋은 웹페이지 즐겨찾기