Delphi Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
델파이 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
FreePascal/Lazarus
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
델마당
볼랜드포럼 광고 모집

델파이 Q&A
Delphi Programming Q&A
[8707] 스트링그리드(StringGrid)에서 셀정렬을 어떻게하는지....
레마 [] 1056 읽음    2003-03-19 16:38
StringGrid를 사용합니다.
StringGridDrawCell 이벤트에서 각 셀마다 오른쪽, 왼쪽, 중앙정렬 을 하고싶습니다.
 
SetTextAlign 라는 함수를 이용해서 정렬을 하고 싶은데 에러가 나네요..
정확한 코딩을 알려주세요....
 
procedure Ta.StringGridDrawCell(Sender: TObject; ACol, ARow: Integer;
  Rect: TRect; State: TGridDrawState);
var
   oldalign, Left, Top : Integer;
begin
  inherited;
       Left := Rect.Left + Round((Rect.Right-Rect.Left-sgrd_s1.Canvas.TextWidth(sgrd_s1.Cells[Acol,ARow]))/2);
       Top  := Rect.Top + 2;  
  case ACol of
     0: 
        oldalign := SetTextAlign(sgrd_s1.Canvas.Handle, TA_CENTER); 중앙정렬
        sgrd_s1.Canvas.TextRect(Rect, ((Rect.Right+Rect.Left) div 2), Rect.Top+2, sgrd_s1.Cells[Acol,ARow]);
        SetTextAlign(StringGrid1.Canvas.Handle, oldalign);
   end;
 
end;


+ -

관련 글 리스트
8707 스트링그리드(StringGrid)에서 셀정렬을 어떻게하는지.... 레마 1056 2003/03/19
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.