L
luaijun
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TForm1.FormCreate(Sender: TObject);
var Bitmap:TBitMap;
begin
ListBox1.Items:=Screen.Fonts;
Bitmap:=TBitMap.Create ;
Bitmap.LoadFromFile('FIRST.BMP');
TabSet1.Tabs.AddObject('first',Bitmap);
Bitmap:=TBitMap.Create ;
Bitmap.LoadFromFile('LAST.BMP');
TabSet1.Tabs.AddObject('last',Bitmap);
end;
procedure TForm1.ListBox1MeasureItem(Control: TWinControl; Index: Integer;
var Height: Integer);
begin
with ListBox1.Canvas do
begin
Font.Name :=ListBox1.Items[index];
Height:=TextHeight('a');
end;
end;
procedure TForm1.TabSet1MeasureTab(Sender: TObject; Index: Integer;
var TabWidth: Integer);
var BitmapWidth:Integer;
begin
BitmapWidth:=TBitmap(TabSet1.Tabs.Objects[index]).Width;//这句有错,去掉后编译通过
Inc(TabWidth,2+BitmapWidth);
end;
procedure TForm1.TabSet1DrawTab(Sender: TObject; TabCanvas: TCanvas;
R: TRect; Index: Integer; Selected: Boolean);
var Bitmap:TBitMap;
begin
Bitmap:=TBitMap(TabSet1.Tabs.Objects[index]);
with TabSet1.Canvas do
begin
Draw(R.Left,R.Top+4,Bitmap);
TextOut(R.Left+2+Bitmap.Width,R.Top+2,TabSet1.Tabs[index]);
end;
end;
procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
begin
with ListBox1.Canvas do
begin
FillRect(Rect);
Font.Name:=ListBox1.Items[index];
TextOut(Rect.Left,Rect.Top,ListBox1.Items[index]);
end;
end;
end.