Visual Basic, C & C++
분류 Delphi

[왕초보팁] 왕초보를 위한 아주 기본적인 Tips

페이지 정보

본문

[펌] http://www.delmadang.com/community/bbs_view.asp?bbsNo=3&bbsCat=0&indx=435748&page=2


목차
 
1. 데이터 저장 및 누적
2. RGB Color 색상값 이용하기(레드 그린 블루)
3. 최소화 비활성화(프로퍼티에도 있음)
4. 라벨 글자위치 정가운데
5. MonthCalendar에서 날짜 클릭시 그 날짜를 에디트박스에 불러온다.
6. 에디트박스에 통화표시(콤마) 찍는 방법
7. 한글/영어모드 전환
8. MonthCalendar를 오늘 날짜로 셋팅
9. 프로그램 시작시 에디트박스에 초점 맞추기
10. Stringgrid 모든셀 가운데 정렬
11. StringGrid 셀에 내용 넣는 방법
12. Form2 띄우는 방법(새창 띄우기)
13. 에디트박스에서 엔터 치면 창 닫는 방법
14. StringGrid 내용을 txt파일에서 로딩&세이브 하는 방법
15. ListBox에 항목(items) 추가하기
16. ListBox에서 선택하면 에디트박스에 글써지는 방법
17. StringGrid 셀 내용 클리어하기
18. StringGrid 맨 아래에 글씨를 고정시키기(예를 들어 합계라는 글씨가 맨아래)
19. StringGrid 셀 합계 구하기
20. 에디트박스(Editbox)에 숫자만 입력 가능하도록 하는 방법
21 ListBox에서 선택한 것 버튼에서 실행
22. 화면 중앙에 Form1이 뜨도록 하는 방법
23. CapsLock 키 자동으로 켜주기
24. 10진수를 2진수로 바꾸는 방법(2가지)
25. 10진수를 16진수로 바꾸는 방법
26. 2진수를 10진수로 바꾸는 방법
27. 16진수를 10진수로 바꾸는 방법(최대 7FFFFFFF까지 가능)
28. *.ini 파일로 저장하고 불러오기 (1/28추가)
29. X(종료) 누르면 종료하시겠습니까? 예/아니오 물어보도록 하기 (1/30추가)
30. 버튼 누르면 txt파일 또는 exe파일 열기 실행하기(2/4추가)
31. TMainmenu 메뉴 바에 구분선 넣기
32. Cnpack 사용시 도구들 줄임말로 표현되는 것 켜고 끄기
33. 현재시간 memo1에 표시하기
34. Form2에서 Form1 사용하기, 연동시키기
35. 인터넷 창 크기 조절해서 창띄우기(internet explorer)
36. 화면 캡쳐 저장 한번에 하는 프로그램 만들기(13.02.27추가)
37. 폴더 추가하기
38. 프로그램 중복 실행 방지
39. 프로그램 트레이아이콘으로 최소화 시키기
40. 게이지바 만들기
41. 폼 닫을 때 오류 (Form1와 Form2가 있는데 Form 닫으면 오류)
42. 모두선택 복사 붙여넣기(컨트롤A 컨트롤C 컨트롤V) 아스키코드
43. 폼에 마우스로 그림그리기
44. 파일이 존재하지 않을 시 파일을 생성
45. 메모(memo)를 txt파일로 저장하기
46. OpenDialog에서 Listbox로 여러 파일 불러오기
 
==========================================



 델파이 입문 2주차입니다
델마당을 통해서 많은 궁금증을 속시원하게 해결할 수 있었습니다
아주 기초적인 것인데 아무것도 모를때 답답할 때 델마당에서 자료를 찾았었는데요
왕초보들을 위한 팁들을 공유하려고 글을 썼습니다.^^

1. 데이터 저장 및 누적
내용 : 메모1에 텍스트를 추가하고 싶을때
memo1.lines.add('추가할 내용');
그리고 데이터 누적
var i,a:integer;
begin
 a:=a+i;
end;

2. RGB Color 색상값 이용하기(레드 그린 블루)
Form1.Color:=RGB($FF,$99,$CC); // 분홍색

3. 최소화 비활성화(프로퍼티에도 있음)
Form1.bordericons:=form1.bordericons-[biMinimize];

4. 라벨 글자위치 정가운데
프로퍼티에서 Alignment를 taCenter , Layout을 tiCenter으로 한다.

5. MonthCalendar에서 날짜 클릭시 그 날짜를 에디트박스에 불러온다.
procedure MonthCalendar Click // 달력클릭시
Edit1.text:= DateToStr(call.Date);

6. 에디트박스에 통화표시(콤마) 찍는 방법
Edit2의 이벤트(event)에서 EXIT에다가 아래를 쓴다
Edit2.text:= FormatFloat('#,###,##0',StrToint(Edit2.text);)

Edit2의 이벤트(event)에서 Enter에다가 아래를 쓴다
Edit2.text:= StringReplace(Edit2.Text,',','',[rfReplaceAll]);
또는

Edit2.text:=FloatToStrF(StrToInt(edit1.text),ffnumber,10,0);
// 위 한줄로 끝납니다 Edit1에 있는 숫자를 Edit2에 콤마를 찍어서 표현할 수 있습니다
// FFnumber이나 FFGeneral을 쓰시면 됩니다


7. 한글/영어모드 전환
Edit1.ImeMode:= imHanguel; //한글
Edit1.ImeMode:= imAlpha; //영어

8. MonthCalendar를 오늘 날짜로 셋팅
Procedure Form1.Create 에 사용
MonthCalendar1.Date:= Date;

9. 프로그램 시작시 에디트박스에 초점 맞추기
Procedure Form1.Show // Form1의 이벤트 Show에다가 사용
Edit1.SetFocus;

10. Stringgrid 모든셀 가운데 정렬
-> Form3의 이벤트 중에 DrawCell 이벤트에다가 사용
procedure TForm3.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
  Rect: TRect; State: TGridDrawState);
 
var
pStr: string;
pLeft: integer;
 
begin
  with (Sender as TstringGrid) do
  begin
  SetTextAlign(handle, ta_left);
  pStr := Cells[ACol, ARow];
  //모든열 가운데 정렬
    begin
      pLeft := ((Rect.Right - Rect.Left - Canvas.TextWidth(pStr)) div 2) + Rect.Left;
      Canvas.TextRect(Rect, pLeft, Rect.Top + 2, pStr);
    end;
    end;
    end;

11. StringGrid 셀에 내용 넣는 방법
Form1 이벤트 중 Create에 사용
StringGrid1.Cells[0,0]:='셀에 넣을 말';

12. Form2 띄우는 방법(새창 띄우기)
먼저 프로그램 맨위에 uses절에 unit2 를 추가합니다.
button1 이벤트 중 Click에 사용
var AForm:TForm2;
begin
  Aform:=TForm2.Create(nil);
  try
    if Aform.Showmodal = mrOK then
  finally
    FreeAndNil(Aform);
  end;
end;

* showmodal을 쓰면 Form1와 Form2 창 전환이 불가능하다.
* 창이동이 자유롭게 만들려면 아래처럼 하면된다.
procedure TForm1.Button1Click(Sender: TObject);
var
Aform:Tform2;
 
begin
  Aform:=TForm2.Create(nil);
  Aform.Show;
end;

13. 에디트박스에서 엔터 치면 창 닫는 방법
Edit1 이벤트 중에 KeyPress에 사용
if Key=#13 then Close;

엔터치면 버튼1 실행하는 방법
if Key=#13 then button1Click(nil);

14. StringGrid 내용을 txt파일에서 로딩&세이브 하는 방법
  procedure SaveStringGrid(StringGrid: TStringGrid; const Delimiter: char; const FileName: TFileName);
var
  y: integer;
  buffer: TStringList;
begin
 
  buffer := TStringList.Create;
  try
    for y := 0 to StringGrid.RowCount - 1 do
    begin
      StringGrid.Rows[y].Delimiter := Delimiter;
      buffer.Add(StringGrid.Rows[y].DelimitedText);
    end;
    buffer.SaveToFile(FileName);
  finally
    buffer.Free;
  end;
 
end;
 
 
procedure LoadStringGrid(StringGrid: TStringGrid; const Delimiter: char; const FileName: TFileName);
 
  function GetDelimiterCount(const data: string): integer;
  var
    x: integer;
  begin
    result := 0;
    for x := 1 to Length(data) do
      if data[x] = Delimiter then result := result + 1;
  end;
 
var
  y: integer;
  buffer: TStringList;
 
begin
 
  buffer := TStringList.Create;
  try
    buffer.LoadFromFile(FileName);
    StringGrid.RowCount := buffer.Count;
    StringGrid.ColCount := GetDelimiterCount(buffer[0]) + 1;
    for y := 0 to buffer.Count - 1 do
    begin
      StringGrid.Rows[y].Delimiter := Delimiter;
      StringGrid.Rows[y].DelimitedText := buffer[y];
    end;
  finally
    buffer.Free;
  end;
 
end;

// 저장버튼 수행
procedure TForm3.Button1Click(Sender: TObject);
begin
     SaveStringGrid(StringGrid1, '=', 'c:/test.txt');
end;

procedure TForm3.Button2Click(Sender: TObject);
begin
// 파일불러오기
LoadStringGrid(StringGrid1, '=', 'c:/test.txt'); 
 end;

15. ListBox에 항목(items) 추가하기
procedure TForm1.FormCreate(Sender: TObject);
begin
  listbox1.Items.Add('항목내용');
end;

16. ListBox에서 선택하면 에디트박스에 글써지는 방법
procedure TForm1.Button1Click(Sender: TObject);
Edit1.text:=Listbox1.items.Strings[listbox1.itemindex]; 

17. StringGrid 셀 내용 클리어하기
var 
index:integer;
begin
with stringgrid1 do
for index:=0 to colcount -1 do
cols[index].clear;
end;

18. StringGrid 맨 아래에 글씨를 고정시키기(예를 들어 합계라는 글씨가 맨아래)
begin
StringGrid1.Cells[0,StringGrid1.rowcount-1]:='합계';

end;

19. StringGrid 셀 합계 구하기
With AdvStringGrid do
begin
Edit1.Text:=FloatToStr(ColumnSum(FixedRows,RowCount-1));
end;
또는
var tmp:Double;
begin
tmp:=0;
for i:=0 to AdvStringGrid.Rowcount -1 do
begin
tmp:= tmp + AdvStringGrid.Floats[1,i];
break;
end;
Edit1.text:=FloatToStr(tmp);

20. 에디트박스(Editbox)에 숫자만 입력 가능하도록 하는 방법
Edit1의 KeyPress 이벤트에 작성
if Key in ['0'..'9','-',#25,#08]=false then
// 마이너스(-), #25는 BackSpace, #08은 방향키
begin
  key:=#0;
end;

21 ListBox에서 선택한 것 버튼에서 실행
procedure TForm1.Button1Click(Sender: TObject);
begin
if ListBox1.Selected[0] then // 리스트박스의 맨위에거(0) 선택하면
  Showmessage('첫번째것을 고르셨습니다ㅋㅋ');
end;

22. 화면 중앙에 Form1이 뜨도록 하는 방법
procedure TForm1.FormCreate(Sender: TObject);
begin
Form1.Left:= (screen.width - Form.width) div 2;
Form1.Top:= (screen.Height - Form.Height) div 2;
end;

23. CapsLock 키 자동으로 켜주기
procedure TForm1.FormCreate(Sender: TObject);
  var ipkeystate:TKeyboardState;
  begin
    GetKeyboardstate(ipkeystate);
    ipkeystate[VK_CAPITAL]:=1;
    SetKeyboardState(ipkeyState)
  end;

24. 10진수를 2진수로 바꾸는 방법(2가지)
1) 첫번째
function DecToBinStr(n: integer): string;//10진수를 2진수로
var
  S: string;
  i: integer;
  Negative: boolean;
  begin
  if n = 0 then
  begin
    Result := '0';
    System.Exit;
  end;
  Negative := False;
  if n < 0 then
  Negative := True; // 음수표시
  n := Abs(n);
  for i := 1 to SizeOf(n) * 8 do
  begin
  if n < 0 then
    S := S + '1' else S := S + '0';
    n := n shl 1;
  end;
  Delete(S,1,Pos('1',S) - 1); //remove leading zeros
  end;

2) 두번째
procedure TForm1.Button1Click(Sender: TObject);
var b,v:Integer; s:string;
    begin
      edit1.MaxLength:=10;
      s := '';
      v := strToint(Edit1.text);
     repeat
      if Odd(v) then s := '1' + s // odd(v) : v가 홀수면
      else s := '0' + s;
         v := v shr 1;
     until v = 0;
     Edit2.text := s;
    end;

25. 10진수를 16진수로 바꾸는 방법
// 컴퓨터가 계산할수 있는 최대값이 2147483647까지임.
procedure TForm1.Button1Click(Sender: TObject);
    begin
      edit1.MaxLength:=9; // 에디트박스를 9까지 제한
      edit2.text:=InttoHex(strtoint(Edit1.Text),1);
    end;

26. 2진수를 10진수로 바꾸는 방법
function Bin2Dec(BinString: string): LongInt;
var
  i : Integer;
  Num : LongInt;
begin
  Num := 0;
  for i := 1 to Length(BinString) do
    if BinString[i] = '1' then Num := (Num shl 1) + 1
                          else Num := (Num shl 1);
 
  Result := Num;
end;

procedure TForm1.Button1Click(Sender: TObject);
    begin
      edit1.MaxLength:=10;
      Edit2.text:=IntToStr(Bin2Dec(edit1.text));
    end;

27. 16진수를 10진수로 바꾸는 방법(최대 7FFFFFFF까지 가능)
      begin
        edit1.MaxLength:=7;
        edit2.Text:=IntToStr(strtoint('$'+edit1.text));
      end;

28. *.ini 파일로 저장하고 불러오기 (1/28추가)
1) uses 절에 iniFiles 추가
2) ButtonClick 프로시져 만들기
3) 프로그램
var
 ini_fun : TiniFile;
 ini_cnt : String;

// ini 파일 생성 코드
 ini_fun : TiniFile.Create('Options.ini');
 ini_fun.WriteString('설정사항','Records',Edit1.Text);

// ini 파일을 읽어오기
 ini_cnt := ini_fun.ReadString('설정사항','Records',Edit1.Text);

* Integer를 읽고 쓰려면 Read자리에 Integer를 쓰고 뒤에있는 파라미터에 Integer형으로 기록한다.
* exe파일이 위치한 폴더에 저장하기
 myini := TiniFile.Create(ExtractFilePath(Application.EXEName)+'Save.ini');

29. X(종료) 누르면 종료하시겠습니까? 예/아니오 물어보도록 하기 (1/30추가)
Form의 Object Inspector에서 Events에서
OnCloseQuery라고 있습니다.
OnCloseQuery 프로시져를 만듭니다

procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
 CanClose := ( MessageDlg('Exit Now?', mtConfirmation, [mbOk, mbCancel], 0) = mrOk)
end;
 
30. 버튼 누르면 txt파일 또는 exe파일 열기 실행하기(2/4추가)
버튼 눌렀을때 메모장파일을 열고싶었는데 FileOpen을 이용하는줄알았는데
아래와 같이 한줄로 끝나더군요 ShellExecute 잘알아두면 유용할것 같습니다.

uses 절에
ShellAPI;  << 추가해줍니다.

procedure TForm1.Button1Click(Sender: TObject);
    begin
      ShellExecute(Handle,'open','c:\jyc\열고싶은파일.txt',Nil,Nil,SW_ShowNormal);
    end;

31. TMainmenu 메뉴 바에 구분선 넣기

 Caption 에 -  << 이것을 입력하면 됩니다.

32. Cnpack 사용시 도구들 줄임말로 표현되는 것 켜고 끄기

Cnpack 메뉴에서 Prefix Wizard... 메뉴를 클릭하고 Continue 클릭
Settings 로 들어가서 Display Settings의
Enable Modify Prefix Automatically를 체크해제하면 자동줄임말이 취소되고
체크를 하면 자동으로 줄여줍니다.

33. 현재시간 memo1에 표시하기
begin
memo1.Lines.add(ForMatDateTime('YYYY-MM-DD HH:MM:SS',now));
end;

34. Form2에서 Form1 사용하기, 연동시키기
Form1에서 Form2를 사용하려면 uses 절에다가 unit2를 추가 시키면 되지만
거꾸로 Form2에서 Form1을 사용하려면 약간 다릅니다.

Form2 프로그램 맨 위에 보면 implementation 이라고 있습니다
implementation
uses
  unit1;
이라고 하면 됩니다. implementation절에 uses unit1;을 추가하면 됩니다.


35. 인터넷 창 크기 조절해서 창띄우기(internet explorer)

uses절에 ComObj를 추가하시고요 아래와 같이 하시면 됩니다. 

procedure TForm1.Button1Click(Sender: TObject); 
const 
strURL = 'http://www.delmadang.com'; 
var 
IE: Variant; 
begin 
IE := CreateOleObject('InternetExplorer.Application'); 
IE.Width := 800; 
IE.Height := 600;
IE.Navigate(strURL); 
IE.Visible := True; 
end; 

36. 화면 캡쳐 저장 한번에 하는 프로그램 만들기

procedure TForm1.Button1Click(Sender: TObject);
var
  Bitmap: TBitmap;
  dc:integer;
begin
  Bitmap := TBitmap.Create;
  Bitmap.Width := screen.width;
  Bitmap.Height := Screen.Height;

  // 바탕화면은 0, 원하는 프로그램이 있다면 프로그램 핸들
  dc := GetDC( 0 );

  BitBlt( Bitmap.Canvas.Handle, 0, 0, Bitmap.Width, Bitmap.Height, dc, 0, 0, SRCCOPY );
  ReleaseDC( 0, dc );

  Bitmap.SaveToFile('c:\jyc\001.bmp');
end;


37. 폴더추가하기
if DirectoryExists('c:\폴더명')=false then
    ForceDirectories('c:\폴더명');

38. for 문 사용하기 // listbox1, listbox 자동선택하기 및 자동삭제
procedure TForm1.Timer1Timer(Sender: TObject); // 타이머1 생성하여 interval=1000으로함
var i:integer;
begin
edit1.Text:=FormatDateTime('hh:mm:ss',now); // 저 같은경우 edit1에 현재시간을 표시함
for i:=0 to listbox1.Items.Count-1 do // for문시작
begin
if Edit1.text=ListBox1.Items.Strings[i] then // edit1과 listbox1 항목이 일치하면
  begin
    ListBox1.ItemIndex:=ListBox1.ItemIndex + i + 1; // 기본이 0이 선택이기때문에(안보임) +i +1을 해줘야 선택이제대로됌
    if ListBox1.Selected[i]=True then // 선택되면
    begin
      listbox1.DeleteSelected; // 지운다
      Break; // 반드시 뷁을 써줘야지 에러가 안생김ㅋㅋ 이거때문에 개고생..-_- for문에는 break를 뷁을 꼭쓰세요
    end
  end
end;
end;


38. 프로그램 중복 실행 방지(13.05.21 추가)
 - 프로그램의 기본이 되는 역할

procedure TForm1.FormCreate(Sender: TObject);
begin
  Screen.Cursor := crHourGlass;
  CreateFileMapping($FFFFFFFF, nil, PAGE_READWRITE, 0, 1, 'project1.exe');
  if GetLastError = ERROR_ALREADY_EXISTS then
    begin
      MessageDlg('프로그램이 이미 실행중 입니다. 확인 하십시오.', mtError, [mbOK], 0);
      Application.Terminate;
      Exit;
    end;
end;


39. 프로그램 트레이아이콘으로 최소화시키기(130521 추가)
  - 트레이아이콘으로 최소화 / 트레이아이콘에서 마우스 오른쪽 버튼 클릭시 종료

프로그램 거의 맨 위쪽에 보시면
private 라고 있습니다 이곳에다가
procedure WndProc(var Msg: TMessage); override; //<-- 선언
위에것을 넣어줍니다

그리고 그 아래쯤에 var이라는 곳에 아래 것을 넣어줍니다.
var
gTray : TNOTIFYICONDATA; //트레이 구조체선언(전역변수)


 
그리고 아래것을 프로그램 작성하는 부분에 추가해주세여
procedure TForm1.WndProc(var Msg: TMessage);
begin
if Msg.WParam = SC_MINIMIZE then begin//최소화버튼 눌렀을때 트레이로
ShowWindow( Application.Handle, SW_MINIMIZE ); //테스크바..
gTray.Wnd := Form1.Handle;
gTray.uId := 1;
gTray.uFlags := NIF_ICON + NIF_TIP + NIF_MESSAGE;
gTray.ucallbackMessage := WM_RBUTTONDOWN ;
gTray.hIcon := Form1.Icon.Handle; //폼의아이콘 -> Tray 아이콘
gTray.szTip := '툴팁이랍니다..' + #13#10 + 'ㅎㅎㅎㅎㅎ'; //툴 팁~
ShellApi.Shell_NotifyIcon( NIM_ADD, @gTray );
ShowWindow( Application.Handle, SW_HIDE ); //테스크바에서 사라지게
end
else begin
case Msg.LParam of
WM_LBUTTONDBLCLK://트레이의 아이콘 좌측더블클릭시
begin
ShowWindow( Application.Handle, SW_SHOW ); // 태스크바에 보이기
ShowWindow( Application.Handle, SW_RESTORE ); // 폼 되돌리기
Shell_NotifyIcon( NIM_DELETE, @gTray ); // 트레이의 아이콘 삭제
end;
end;
case Msg.LParam of
      WM_RBUTTONDOWN:  //트레이의 아이콘 우측클릭시 종료메세지뜸
      begin
        ok:=Application.MessageBox('Exit now?','Yes',MB_OKCANCEL);
        if Ok=idok then
        begin
          close;
        end;
      end;
    end;
inherited;
end;

그리고 Form1의 Object Inspector (F11하다보면 나오는 설정하는곳)에서
Icon에다가 *.ico 파일을 설정해줍니다.(트레이아이콘에 표시할 아이콘)
그럼 끝
 
40. 게이지바 만들기
탭메뉴에 보면 Samples라고 있는데 
그곳에 Gauge 게이지라고 있습니다.

폼에 게이지바를 하나 넣고
System에서 Timer 를 하나 넣습니다.

타이머를 더블클릭하시구 아래 게이지가 차도록 넣으시면 됩니다.
타이머 동작할때마다 10%씩 올라갑니다.

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  Gauge1.AddProgress(10);
end;

41. 폼 닫을 때 오류 발생 원인 및 해결
Form1과 Form2가 있을때
Form2를 메인폼으로 사용하고 Form1을 자녀?폼으로 사용하면
Form1을 X표 눌러서 종료해도 Form1 메인폼은 닫히지가 않는다
이유는 X표를 눌러 종료하려면 메인폼을 종료해야하기 때문이다.

Close; 를 사용해도 현상이 해결되지 않는이유다.
이때는 이것을 사용해야한다.

자녀폼에서 종료를 하고 싶을때
Form1 (자녀폼)에서 이벤트 중에

procedure TForm1.Onclose 에다가

Application.Terminate;

이걸 추가해주면 해결 된다.

42. Ctrl+A Ctrl+C Ctrl+V 컨트롤C 컨트롤A 모두선택 복사 아스키코드 구현하기 (13.05.23 추가)
memo1 에서 메모장처럼 컨트롤 A를 하면 안먹힙니다.
이럴땐 아스키코드를 이용해야하는데..

#1 은 Ctrl+A를 뜻합니다
#3 은 Ctrl+C를 뜻합니다

1,2,3,,,, 차례대로 A,B,C,D... 이죠.

아래는 소스입니다.

procedure TForm1.Memo1KeyPress(Sender: TObject; var Key: Char);
begin
  if Key = #3 then
  begin
    Memo1.CopyToClipboard;
  end;
  if Key = #1 then
  begin
    memo1.SelectAll;
  end;
end;


43. 폼에 마우스로 그림 그리기, 마우스 움직이면 그림 그려지는 것

폼에 마우스를 올리고 왔다갔다하면 그림이 그려지는 소스입니다.

폼 이벤트 중 mousemove에다가 아래를 집어넣으세요.
rect안의 숫자를 크게할 수록 큰 브러쉬가 됩니다.

procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
  Canvas.Brush.Color:=clblack;
  Canvas.FillRect(Rect(x,y,x+3,y+3));
end;

44. 파일이 존재하지 않을 시 파일을 생성
if not FileExists('me.txt') then
begin
  CreateFile('me.txt'), GENERIC_READ,
                      FILE_SHARE_READ or FILE_SHARE_WRITE or FILE_SHARE_DELETE,
                      nil, OPEN_ALWAYS, 0, 0);
end;

45. 메모(memo)를 txt파일로 저장하기
begin
memo1.Lines.SaveToFile('me.txt);
end;

46. OpenDialog1에서 Listbox로 여러파일 불러오기 (13.07.12 추가)
OpenDialog1 Option에서 ofAllowMultiSelect = True하고.

if OpenDialog1.Execute then
  begin
    for i := 0 to OpenDialog1.Files.Count - 1 do
    begin
      Listbox.items.Add(OpenDialog1.Files[i]);
    end;
  end;

계속 추가예정

관련자료

등록된 댓글이 없습니다.
프로그래밍
Today's proverb
친구를 얻는 유일한 방법은 스스로 완전한 친구가 되는 것이다. (에머슨)