Nope. I need to use inside my vcl.
Main Topics
Browse All TopicsIn my vcl I paint an animated border. If I drop a panel, for example, into my vcl and align to alClient the panel will hide my border. If I decrease my client are the result is the same because my border is paint into client area ( I can't paint into non client area ).
What to do as all new controls droped into my vcl to limit with one pixel untill the border, as my border to be visible ?
Please codes!
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Hi!
You must override the AdjustClientRect method of tWinControl in your component.
AdJustCLientRect is called internally when the component needs kwow where to place the child components.
Here yoy have an example of this:
The example creates a descendent of TPanel with this method overrided.
The method 'reduce' the client area for the childs in 20 pixels.
The example creates a TMyPanel and inside it a TMemo with Align:=alClient;
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
//A TPanel with a clipping area...
TMyPanel = class (TPanel)
private
procedure AdjustClientRect(var Rect: TRect); override;
end;
TForm1 = class(TForm)
Button1: TButton;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TMyPanel.AdjustClientRect(
begin
Rect:=ClientRect;
Inc(Rect.Left,20);
Inc(Rect.Top,20);
Dec(Rect.Right,20);
Dec(Rect.Bottom,20);
end;
procedure TForm1.FormCreate(Sender: TObject);
var
TheSpecialPanel : TMyPanel;
begin
//Create a new panel
TheSpecialPanel:=TMyPanel.
With TheSpecialPanel do begin
Parent:=Self;
Left:=10;
Top:=10;
Width:=200;
Height:=200;
Caption:='';
end;
//Create into the panel anything to view the clipping area:
With TMemo.Create(self) do begin
Parent:=TheSpecialPanel;
Align:=alClient; //Fill all the Panel (except clipped area...)
Left:=10;
Top:=10;
Width:=200;
Height:=200;
end;
end;
end.
sorry, but it looks like I did't understand what your problem is
you have your panel (TMyPanel), then you want to put some component on it (Panel, Memo, ListBox,...) for example, let say that you put panel with name Panel2, and need panel2.align to be alClient -2 pixel.
Is that right ?
If it is, than you can use align_client(panel2);
If that isn't case , can you, please, explain your problem with more details
> I done this but my painted border is on client area too.So I have the border under panel, for example.
Sorry but... I dont understand your problem...
With my example, you can draw in all the rect of the component :?
The AdjustClientRect only is used when childs controls are placed into your vlc, but YourVCL.Clientrect; returns the whole rect of your vlc and you can paint into :?
Have you tested my example?
In my example, you can use something like this:
procedure TForm1.Button1Click(Sender
begin
Panel1.Canvas.Brush.Color:
Panel1.Canvas.FillRect(Pan
Panel1.Canvas.Font.Color:=
Panel1.Canvas.TextOut(0,0,
end;
and you will paint the border of the clipped pannel...
I have done a demo project for you with the whole example.
You can get it at:
http://q3.nu/ClippingPanel
Business Accounts
Answer for Membership
by: kaslaPosted on 2005-09-15 at 10:18:19ID: 14891250
procedure align_client(sender:tcontr ol); ight,akbot tom];
begin
with sender as tcontrol do
begin
top:=2;
left:=2;
width:=(parent as tcontrol).Width-4;
height:=(parent as tcontrol).height-4;
anchors:=[akleft,aktop,akr
end;
end;
now yopu need to call align_client function for every every control for which you want "alClient-2" align
for example
procedure TForm1.FormCreate(Sender: TObject);
begin
align_client(panel2);
end;