当前位置:主页>delphi技巧/代码下载> 文章内容

怎样控制PageControl的TabSheet的Caption的底色?

发布时间:2010-02-03 | QQ免费站
1楼: Form没有Color使用clBtnFace,而用了clGradientActiveCaption(蓝的),放上了PageControl,也加了页,可是那个TabSheet的Caption的底色却回到了clBtnFace那样了,便得屏幕看上去有怪怪的感觉。有什么办法让它的底色与Form同吗?

字串5

2楼: 用Raize里的RzPageControl吧,蛮好用的。可以符合你的要求。
字串3

3楼: procedure Tmainfrm.PageControl1DrawTab(Control: TCustomTabControl; TabIndex: Integer; const Rect: TRect; Active: Boolean); var vDC : HDC; vBrush : HBRUSH; vCatpion : string; vRect : TRect; vOrgFgClr : COLORREF; begin vDC := Control.Canvas.Handle; vCatpion := TPageControl(Control).Pages[TabIndex].Caption; vRect := Rect; vBrush := CreateSolidBrush(ColorToRGB(clBtnFace)); try FillRect(vDC, Rect, vBrush); if Active then begin vOrgFgClr := SetTextColor(vDC, ColorToRGB(clBlue)); Control.Canvas.Brush.Color := clWhite; end else begin vOrgFgClr := SetTextColor(vDC, ColorToRGB(clWindowText)); Control.Canvas.Brush.Color := clBtnFace; end; Control.Canvas.FillRect(Rect); DrawText(vDC, PChar(vCatpion), Length(vCatpion), vRect, DT_VCENTER or DT_CENTER or DT_SINGLELINE); SetTextColor(vDC, vOrgFgClr); finally DeleteObject(vBrush); end; end;
字串9

4楼: Corn2: 哦,那个 Raize 哪里有?

字串8

5楼: TMS可以 http://www.delphifans.com/SoftView/SoftView_678.html
字串3

6楼: www.2ccc.com, 上就有Raize控件,你在盒子上搜索一下就有了。 字串3

7楼: app2001: 把您的代码加进去了,编译成功,可设断点,却未发现程序走进去。奇怪。 字串9

8楼: 画激活页标签的背景和文字
字串4

9楼: delfier: ftp方式的,下载不了,本地服务器限制了。谢谢你! happycyp: 21.7M的一个大东东,呵呵,今天下午可有得试了。 app2001: 不是从PageControl的Events里OnDrawTab连过去就行吗?还需怎样激活?
字串8

10楼: OK了 字串2