xtremecris
asked on
Application as a toolbar
I want to make an app will will stay 'ontop' and in the upper part of the screen but all windows, even maximized, should not ocupy the surface of my application.
Something like the Office Toolbar.
Something like the Office Toolbar.
Hi,
Try this:
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
rectOri: TRect;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
var
rect: TRect;
begin
Left := Screen.DesktopLeft;
Top := Screen.DesktopTop;
Width := Screen.DesktopWidth;
Height := 50; // your form height here
FormStyle := fsStayOnTop;
// Get the current available work area
SystemParametersInfo(SPI_G ETWORKAREA , 0, @rectOri, 0);
// Subtract the rect
SubtractRect(rect, rectOri, Classes.Rect(Left, Top, Width, Height));
// Set this to be the new available work area
SystemParametersInfo(SPI_S ETWORKAREA , 0, @rect, 0);
end;
procedure TForm1.FormDestroy(Sender: TObject);
var
rect: TRect;
begin
// restore rectOri
SystemParametersInfo(SPI_S ETWORKAREA , 0, @rectOri, 0);
end;
Regards, Geo
Try this:
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
rectOri: TRect;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
var
rect: TRect;
begin
Left := Screen.DesktopLeft;
Top := Screen.DesktopTop;
Width := Screen.DesktopWidth;
Height := 50; // your form height here
FormStyle := fsStayOnTop;
// Get the current available work area
SystemParametersInfo(SPI_G
// Subtract the rect
SubtractRect(rect, rectOri, Classes.Rect(Left, Top, Width, Height));
// Set this to be the new available work area
SystemParametersInfo(SPI_S
end;
procedure TForm1.FormDestroy(Sender:
var
rect: TRect;
begin
// restore rectOri
SystemParametersInfo(SPI_S
end;
Regards, Geo
I would suggest creating your app as an appbar... see here for code sample: http://www.delphipages.com/tips/thread.cfm?ID=167
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER