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
|