type
{$IFDEF WINDOWS}
{ TPageControl }
TPageControl = class(ComCtrls.TPageControl)
private
protected
procedure MouseDown(Button: TMouseButton;
Shift: TShiftState; X, Y: Integer); override;
procedure PaintWindow(DC: HDC); override;
var
const btnSize = 10;
const xoff =-2;
const yoff =5;
end;
{$ENDIF}
{$IFDEF WINDOWS}
procedure TPageControl.MouseDown(Button: TMouseButton; Shift: TShiftState; X,
Y: Integer);
var
R : TRect;
begin
inherited MouseDown(Button, Shift, X, Y);
if Button = mbLeft then
begin
R := TabRect(ActivePageIndex);
if PtInRect(Classes.Rect(R.Right - btnSize + xoff-3, R.Top + yoff-3,
R.Right +xoff+4, R.Top + btnSize + yoff+4),
Classes.Point(X, Y))
then ActivePage.Free;
end;
end;
procedure TPageControl.PaintWindow(DC: HDC);
var
i :integer;
R : TRect;
bm : TBitmap;
Pen: HPEN;
OldPen : HPEN;
DrawColor: TColor;
Red, Green, Blue: Byte;
begin
inherited PaintWindow(DC);
bm := TBitmap.Create;
try
bm.SetSize(16, 16);
Images.GetBitmap(0, bm);
for i := 0 to Pred(PageCount) do
begin
R := TabRect(i);
// Create a pen with desired thickness (e.g., 5)
DrawColor := ColorToRGB(cl3DDkShadow);
Red := GetRValue(DrawColor);
Green := GetGValue(DrawColor);
Blue := GetBValue(DrawColor);
Pen := CreatePen(PS_SOLID, 1, RGB( red, green, blue)); // 5 is the thickness of the pen
OldPen := SelectObject(DC, Pen);
Rectangle(DC,R.Right - btnSize+Xoff-3 ,R.Top +yoff -3,
R.Right +Xoff +4,r.Top+btnSize +yoff +4 );
Pen := CreatePen(PS_SOLID, 2, RGB( red, green, blue)); // 5 is the thickness of the pen
OldPen := SelectObject(DC, Pen);
MoveToEx(DC,R.Right - btnSize+Xoff ,R.Top +yoff ,Nil) ;
LineTo(DC,R.Right +Xoff ,r.Top+btnSize +yoff) ;
MoveToEx(DC,R.Right - btnSize +Xoff,R.Top + btnsize + yoff,Nil) ;
LineTo(DC,R.Right +Xoff ,R.Top +yoff ) ;
//Alternative
// StretchBlt(DC, R.Right - btnSize - 4, R.Top + 2,
// btnSize, btnSize, bm.Canvas.Handle, 0, 0, 16, 16, cmSrcCopy);
end;
finally
bm.Free;
SelectObject(DC, OldPen);
DeleteObject(Pen);
end;
end;
{$ENDIF}