본문 바로가기

삽질61

[Delphi] StringGrid - Mouse move Cell hint procedure TFm_Test.AdvStringGridMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); var ACol, ARow: Integer; begin AdvStringGrid.ShowHint := False; AdvStringGrid.MouseToCell(X, Y, ACol, ARow); if (ACol < 2) or (ARow < 1) then Exit; // fix and checkbox AdvStringGrid.ShowHint := True; AdvStringGrid.Hint := AdvStringGrid.Cells[ACol, ARow]; end; 2012. 1. 11.
[Delphi] 문자열의 너비 구하기 uses Graphics; Canvas.TextWidth(str); ex) if Canvas.TextWidth(Cells[5, J]) > 220 then RowHeights[J] := 16 * ((Canvas.TextWidth(Cells[5, J]) div 220) + 1); 2012. 1. 11.
[Delphi] Socket Error 10004 The operation is canceled. 10013 The requested address is a broadcast address, but flag is not set. 10014 Invalid argument. 10022 Socket not bound, invalid address or listen is not invoked prior to accept. 10024 No more file descriptors are available, accept queue is empty. 10035 Socket is non-blocking and the specified operation will block. 10036 A blocking Winsock operation is in progres.. 2011. 8. 31.
[Delphi] 델파이 예외 처리 클래스 EAbort 메시지 상자를 출력하지 않고 현재의 코드 블록을 취소할때 발생 EOutOfMemory 애플리케이션을 실행하기 위한 메모리 부족시 발생 EAccessViolation 메모리가 할당되지 않은 상황에서 연산을 하거나 메모리 할당 후 해제하지 않고 다시 할당할때 발생 EstackOverflow 현재의 스레드 수행이 더이상 메모리에 할당될 수 없을 경우 ElnOutError 파일 입출력시에 에러가 나는 경우 ElntError 정수 연산시 발생하는 에러 EDeivByZero 정수를 0으로 나누었을 때 발생 ERangeError 정수형의 범위를 벗어나는 값이 할당 됐을 경우 ElnvalidPointer 부적절한 포인터 연산이 수행됐을 경우 ElnvalidCast as연산자를 이용하여 부적절한 형변환이 발.. 2011. 8. 3.
[Delphi] 파일 확장자 알아내기 function GetExt(FileName: string): string; var TempArray: TStringList; begin Result := ''; TempArray := TStringList.Create; ExtractStrings(['.'], [' '], PChar(FileName), TempArray); if Pos('.', FileName) 0 then Result := TempArray.Strings[TempArray.Count - 1]; TempArray.Clear; TempArray.Free; end; 2011. 7. 22.
[Delphi] ListBox 내용을 클립보드에 복사하기 uses절에 Clipbrd; 추가하고 ClipBoard.SetTextBuf( PChar(복사 할 내용) ); ex) ClipBoard.SetTextBuf( PChar( Listbox.Items.Strings[Listbox.ItemIndex] ) ); ClipBoard.SetTextBuf( PChar( Listbox.Items.Text ) ); 2011. 7. 15.
[Delphi] 델파이에서 파일쓰기 var F: TextFile; FileName: string;begin FileName := '파일명'; try try AssignFile(F, FileName); // 파일이 없으면 파일을 생성 if FileExists(FileName) then Append(F) // 기존 내용에 추가하기 else Rewrite(F); // 기존 내용을 덮어쓰기 Writeln(F, '작성 할 내용'); except on E: Exception do ; end; finally CloseFile(F); end; end; 2011. 6. 15.
[Delphi] 최상위 윈도우가 전체화면인지 확인하기 function IsMaxWindow: boolean; var Hnd: HWND; Rect: TRect; begin Result := False; Hnd := GetForegroundWindow(); // 현재 작업중인 윈도우를 알아내는 함수 GetWindowRect(Hnd, Rect); if (Rect.Left Rect.Top) then exit; if (Rect.Right = Screen.Width) and (Rect.Bottom = Screen.Height) then Result := True; // 전체화면 end; 2011. 5. 16.
[Delphi] 폼 드래그해서 이동하기 MouseDown 이벤트에서 ReleaseCapture; SendMessage(Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0); 2011. 5. 16.
[Delphi] 하위 폴더까지 한번에 생성하기 uses SysUtils; function ForceDirectories(Dir: string): Boolean; 이런 좋은 함수를 이제야 알다니.. 2011. 5. 16.