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
[10731] 그런데요...
이승근 [] 1333 읽음    2006-06-07 22:35
감솨감솨...^^;;
역시 안영제님 덕에 제가 삽니다요...ㅋㅋㅋ
그런데 정렬은 어떻게 적용합니까??
가운데 정렬을 해야하는디요...
글고 시간나면 카페에 한번 들려주세요...^^

civilian,안영제 님이 쓰신 글 :
: TDBGrid의 OnDrawColumnCell 이벤트에서 다음과 같이 코드를 붙이면 됩니다.
:
: procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
:   DataCol: Integer; Column: TColumn; State: TGridDrawState);
: begin
:   if Column.Index = 1 then
:     with DBGrid1.Canvas do
:     begin
:       Brush.Color := clBlue;
:       FillRect(Rect);
:       TextOut(Rect.Left, Rect.Top, Column.Field.Value);
:     end;
: end;
:
:
:
: 이승근 님이 쓰신 글 :
: : procedure Twonjang6F.DrawField(const Value : String; const Rect : TRect;
: :           vCanvas : TCanvas; vFont: TFont; vAlignment: TAlignment;
: :           FontStyle : TFontStyles; FontColor : TColor; BGColor : TColor);
: : var I : Integer;
: : begin
: :   I := 0;
: :   vCanvas.FillRect(Rect);
: :   SetBkMode(Canvas.Handle, TRANSPARENT);
: :   vCanvas.Font := vFont;
: :   vCanvas.Font.Style := FontStyle;
: :   vCanvas.Font.Color := FontColor;
: :   vCanvas.brush.Color := BGColor;
: :   case vAlignment of
: :     taRightJustify :
: :       begin
: :         SetTextAlign(vCanvas.Handle, TA_RIGHT);
: :         I := Rect.Right - 2;
: :       end;
: :
: :     taLeftJustify :
: :       begin
: :         SetTextAlign(vCanvas.Handle, TA_LEFT);
: :         I := Rect.Left + 2;
: :       end;
: :
: :     taCenter      :
: :       begin
: :         SetTextAlign(vCanvas.Handle, TA_CENTER);
: :         I := (Rect.Right + Rect.Left) DIV 2;
: :       end;
: :   end;
: :   vCanvas.TextRect(Rect, I, Rect.Top + 2, Value);
: :   SetTextAlign(vCanvas.Handle, TA_LEFT);
: : end;
: :
: : procedure Twonjang6F.DBGrid1DrawColumnCell(Sender: TObject;
: :   const Rect: TRect; DataCol: Integer; Column: TColumn;
: :   State: TGridDrawState);
: : begin
: :   with Sender as TDBGrid, DataSource.DataSet do
: :      if FieldByName('gub1').AsString = '@' then
: :         DrawField(Column.Field.DisplayText, Rect, Canvas, Column.Font, Column.Alignment, [], clBlue, clWindow);
: : end;
: :
: : 보통 위의 형식으로 행의 색은 바꾸었는데 특정열 즉, 특정 필드의 글자들만 색상을 바꾸고 싶습니다...
: : 예를 들어 a1, a2, a3, a4... 등의 필드가 있고 이것이 모두 DBGrid에 표시가 된다면 이중 a2필드의 글자들만 window바탕에 파란색으로 표시하고 싶습니다... 나머지는 물론 자연 그대로 표시하구요...
: : 어떻게 할까요??

+ -

관련 글 리스트
10729 [질문]특정 열의 글자만 색을 달리하기... 이승근 1325 2006/06/07
10730     Re:[질문]특정 열의 글자만 색을 달리하기... civilian,안영제 1550 2006/06/07
10731         그런데요... 이승근 1333 2006/06/07
10733             Re:그런데요... civilian,안영제 1264 2006/06/07
10734                 Re:Re:그런데요... 이승근 1284 2006/06/07
10735                     Re:Re:Re:그런데요... civilian,안영제 1413 2006/06/08
10742                         대단히 감사합니다. 잘 해결되었습니다..^^[냉무] 이승근 1239 2006/06/13
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.