반응형

tip 35

[팁] 쓸만한 함수 2

[TMemo Component] 현재 라인번호 알아내기 메모에서 현재 Caret이 위치하고 있는 줄이 몇 번째 줄인지를 리턴한다. Label1.Caption := IntToStr(GetCurrLine(Memo1)); function GetCurrLine(Memo : TMemo) : integer; begin Result := Memo.Perform(EM_LINEFROMCHAR, Memo.SelStart, 0); end; [TMemo Component] 현재 컬럼번호 알아내기 메모에서 현재 Caret이 위치하고 있는 줄에서 몇 번째 컬럼인지를 리턴한다. Label1.Caption := IntToStr(GetCurrCul(Memo1)); function GetCurrCul(Memo : TMemo)) : in..

Programming/Delphi 2010.06.30

[팁] 쓸만한 함수

팁모음집 금주가 몇번째 주인지 어떻게 구합니까 function kcIsLeapYear( nYear: Integer ): Boolean; // 윤년을 계산하는 함수 begin Result := (nYear mod 4 = 0) and ((nYear mod 100 0) or (nYear mod 400 = 0)); end; function kcMonthDays( nMonth, nYear: Integer ): Integer; // 한달에 몇일이 있는지를 계산하는 함수 const DaysPerMonth: array[1..12] of Integer = (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); begin Result := DaysPerMonth[nMonth]; if (n..

Programming/Delphi 2010.06.30
반응형