Thread View: borland.public.delphi.clx.components.using
4 messages
4 total messages
Started by ann
Thu, 15 Dec 2005 08:24
PageControl with background
Author: ann
Date: Thu, 15 Dec 2005 08:24
Date: Thu, 15 Dec 2005 08:24
4 lines
1038 bytes
1038 bytes
Hi, is there a way of putting an image as background on the tab header of PageControl? Thanks in advance.
Re: PageControl with background
Author: ann
Date: Tue, 20 Dec 2005 08:50
Date: Tue, 20 Dec 2005 08:50
97 lines
3364 bytes
3364 bytes
Hello, I just found out how to put an image on the tab but the problem is I
put it on the OnChange Event, My problem now is how will i put this during
the creation since I tried it it wont work. Also, I tried three tabs but the
background images covers only two tabs. Is this a bug? here is my code.
unit Unit1;
interface
uses
SysUtils, Types, Classes, Variants, QTypes, QGraphics, QControls, QForms,
QDialogs, QStdCtrls, QComCtrls;
type
TForm1 = class(TForm)
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
Button1: TButton;
TabSheet3: TTabSheet;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure PageControl1Changing(Sender: TObject;
var AllowChange: Boolean);
private
{ Private declarations }
public
{ Public declarations }
end;
TPageControlEx = class(TPageControl)
public
property Bitmap;
property OwnerDraw;
end;
var
Form1: TForm1;
Background : TBitmap;
implementation
{$R *.xfm}
procedure TForm1.FormCreate(Sender: TObject);
var
i: integer;
begin
Background := TBitmap.Create;
// could load bitmap from a resource here
Background.Loadfromfile('back.bmp');
TPageControlEx(PageControl1).OwnerDraw := True;
// subclass the tabsheets, store old window proc in GWL_USERDATA
// field of window structure
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
Background.Free;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
// close;
end;
procedure TForm1.FormShow(Sender: TObject);
begin
pagecontrol1.Brush.Bitmap := Background;
pagecontrol1.Brush.Bitmap.FreeImage;
TPageControlEx(pagecontrol1).Bitmap := Background;
TPageControlEx(pagecontrol1).Bitmap.FreeImage;
end;
procedure TForm1.PageControl1Changing(Sender: TObject;
var AllowChange: Boolean);
begin
(sender as Tpagecontrol).Canvas.Brush.Bitmap := Background;
(sender as Tpagecontrol).Canvas.Brush.Bitmap.FreeImage;
end;
end.
Thanks in Advance.
"ann" <carlo@isap.ph> wrote in message
news:43a127ff@newsgroups.borland.com...
> Hi, is there a way of putting an image as background on the tab header of
> PageControl?
>
> Thanks in advance.
>
>
Re: PageControl with background
Author: theo
Date: Tue, 20 Dec 2005 11:37
Date: Tue, 20 Dec 2005 11:37
12 lines
1588 bytes
1588 bytes
ann schrieb: > Hello, I just found out how to put an image on the tab but the problem is I > put it on the OnChange Event, My problem now is how will i put this during > the creation since I tried it it wont work. Also, I tried three tabs but the > background images covers only two tabs. Is this a bug? here is my code. You could try to write your own TCustomTabControl to have full control over the painting. Since it's based on TCustomControl, it's all in the Delphi source-code. Btw. for CLX related questions, you 'd better ask in borland.public.kylix.non-technical
Re: PageControl with background
Author: ann
Date: Wed, 21 Dec 2005 02:52
Date: Wed, 21 Dec 2005 02:52
20 lines
1719 bytes
1719 bytes
thanks for the reply theo, even if i'm not in the right newsgroup. More power!. "theo" <nospam@for.me> wrote in message news:43a7ebbe$1@newsgroups.borland.com... > ann schrieb: >> Hello, I just found out how to put an image on the tab but the problem is >> I put it on the OnChange Event, My problem now is how will i put this >> during the creation since I tried it it wont work. Also, I tried three >> tabs but the background images covers only two tabs. Is this a bug? here >> is my code. > > You could try to write your own TCustomTabControl to have full control > over the painting. > Since it's based on TCustomControl, it's all in the Delphi source-code. > > Btw. for CLX related questions, you 'd better ask in > borland.public.kylix.non-technical
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads