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
[16136] Re:TcxTabControl font.color 변경방법
[] 994 읽음    2020-11-23 17:00
starter 님이 쓰신 글 :
: 안녕하세요.
: 델파이 개발초보입니다...
: TcxTabControl.font.color가 디자인모드에서도 그러고..실행해서도 마찬가지고.. 속성은 있는데 변경이 안되더라고요..
: 이걸 변경할수 있는 방법이 있을까 싶어서 글을 올려봅니다...
:
: 단순히 font.color를 변경해서 사용하는법이 제일 알고싶습니다 ㅠㅠ

cxTabControl.OwnerDraw := true;  및 DrawTabEx event 를 아래와 같이 적용. 실행시 변경됨.

procedure TForm4.cxTabControl1DrawTabEx(AControl: TcxCustomTabControl; ATab: TcxTab; Font: TFont);
begin
  if ATab.Index = 1 then
  begin
    Font.Style := Font.Style + [fsBold];
    Font.Color := clLime;
  end;
end;


[참조]
cxPageControl을 활용하면 더욱 색상변경까지 더욱 용이함.
cxPageControl1.OwnerDraw := True;
cxPageControl1.OnDrawTabEx 설정.
PageChnage로 Panel Parent 설정하면 화면 Tab처럼 사용가능.

procedure TForm4.cxPageControl1Change(Sender: TObject);
begin
  Panel1.Parent := cxPageControl1.ActivePage;
end;

procedure TForm4.cxPageControl1DrawTabEx(AControl: TcxCustomTabControl; ATab: TcxTab; Font: TFont);
begin
  Font.Style := [fsBold];
  if ATab.Index = 1 then // changing Font color of the second Tab
    Font.Color := clRed;
  if ATab.Caption = 'cxTabSheet3' then
    Font.Color := clBlue;
end;


// 아래 복사 Form에 붙여넣기.
object cxPageControl1: TcxPageControl
  Left = 129
  Top = 286
  Width = 568
  Height = 370
  ActivePage = cxTabSheet1
  LookAndFeel.Kind = lfUltraFlat
  OwnerDraw = True
  Style = 9
  TabOrder = 0
  OnChange = cxPageControl1Change
  OnDrawTabEx = cxPageControl1DrawTabEx
  ClientRectBottom = 370
  ClientRectRight = 568
  ClientRectTop = 20
  object cxTabSheet1: TcxTabSheet
    AlignWithMargins = True
    Caption = 'cxTabSheet1'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clBlack
    Font.Height = -11
    Font.Name = 'Tahoma'
    Font.Style = []
    ImageIndex = 0
    ParentFont = False
    ExplicitLeft = 0
    ExplicitTop = 24
    ExplicitWidth = 289
    ExplicitHeight = 169
    object Panel1: TPanel
      Left = 0
      Top = 0
      Width = 562
      Height = 344
      Align = alClient
      BevelOuter = bvLowered
      Caption = 'Panel1'
      TabOrder = 0
      ExplicitLeft = -1
    end
  end
  object cxTabSheet2: TcxTabSheet
    AlignWithMargins = True
    Caption = 'cxTabSheet2'
    Color = clLime
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clRed
    Font.Height = -11
    Font.Name = 'Tahoma'
    Font.Style = [fsBold]
    ImageIndex = 1
    ParentColor = False
    ParentFont = False
    ExplicitLeft = 0
    ExplicitTop = 24
    ExplicitWidth = 289
    ExplicitHeight = 169
  end
  object cxTabSheet3: TcxTabSheet
    AlignWithMargins = True
    Caption = 'cxTabSheet3'
    ImageIndex = 2
    ExplicitLeft = 0
    ExplicitTop = 24
    ExplicitWidth = 289
    ExplicitHeight = 169
  end
end

+ -

관련 글 리스트
16135 TcxTabControl font.color 변경방법 starter 593 2020/11/19
16136     Re:TcxTabControl font.color 변경방법 994 2020/11/23
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.