您不想要一个完整的玻璃窗口,但您必须自己绘制选项卡,因为我知道没有一个控件可以为您提供所需的确切外观。如果您使用当前窗体的 GlassFrame 属性,请启用它并将顶部设置为您想要的选项卡的高度,在该区域放置一个油漆盒并使用 GDI+ 调用手动绘制您的选项卡。EDN ( http://cc.embarcadero.com/Download.aspx?id=26950 )上提供了一个很好的库,应该适用于此。在不使用 GDI+ 的情况下,您将能够绘制到颜料盒,但黑色会变得透明。使用 GDI+,您可以在任何颜色的玻璃上自由绘制。例如:
资源:
unit Unit6;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, GdiPlusHelpers, GdiPlus, StdCtrls, ExtCtrls;
type
TForm6 = class(TForm)
pb1: TPaintBox;
procedure pb1Paint(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form6: TForm6;
implementation
{$R *.dfm}
procedure TForm6.pb1Paint(Sender: TObject);
var
Graphics : IGPGraphics;
Brush: IGPSolidBrush;
FontFamily: IGPFontFamily;
Font: IGPFont;
Point: TGPPointF;
Pen: IGPPen;
begin
Graphics := Pb1.ToGPGraphics;
Brush := TGPSolidBrush.Create(TGPColor.Create(255, 0, 0, 0));
FontFamily := TGPFontFamily.Create('Consolas');
Font := TGPFont.Create(FontFamily, 12, FontStyleRegular, UnitPoint);
Point.Initialize(1, 0);
Graphics.TextRenderingHint := TextRenderingHintAntiAlias;
Graphics.DrawString('GDI+ Black Text', Font, Point, Brush);
Pen := TGPPen.Create(TGPColor.Create(255, 0, 0, 0));
Graphics.DrawLine(Pen, 0, 0, 200, 100);
end;
end.
形式:
object Form6: TForm6
Left = 0
Top = 0
Caption = 'Form6'
ClientHeight = 282
ClientWidth = 418
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
GlassFrame.Enabled = True
GlassFrame.Top = 22
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object pb1: TPaintBox
Left = 0
Top = 0
Width = 313
Height = 105
OnPaint = pb1Paint
end
end
编辑更新为抗锯齿文本,使其看起来更好。