01
Sep 08

Delphi: Utils :: ToolButtonScreenPos

:: articles :: by Gilberto Saraiva

Folks,

For everybody that needs the ToolButton position:

 Delphi |  copy code |? 
1
type
2
  TToolButtonAccess = class(TToolButton);
3
 
4
function ToolButtonScreenPos(AToolButton: TToolButton): TPoint;
5
begin
6
  GetDCOrgEx(TToolButtonAccess(AToolButton).Canvas.Handle, Result);
7
  Inc(Result.X, AToolButton.Left);
8
  Inc(Result.Y, AToolButton.Top);
9
end;

Hugs!



01
Sep 08

Delphi: Utils :: SpeedButtonScreenPos

:: articles :: by Gilberto Saraiva

Folks,

For everybody that needs the Speedbutton position:

 Delphi |  copy code |? 
1
type
2
  TSpeedButtonAccess = class(TSpeedButton);
3
 
4
function SpeedButtonScreenPos(ASpeedButton: TSpeedButton): TPoint;
5
begin
6
  GetDCOrgEx(TSpeedButtonAccess(ASpeedButton).Canvas.Handle, Result);
7
  Inc(Result.X, ASpeedButton.Left);
8
  Inc(Result.Y, ASpeedButton.Top);
9
end;

Hugs!



01
Sep 08

Delphi: Utils :: DesktopArea

:: articles :: by Gilberto Saraiva

Folks,

For everybody that need to show something only on the useful area of the desktop I wrote this function:

 Delphi |  copy code |? 
1
function DesktopClientArea: TRect;
2
var
3
  rDesktop, rWinBar: TRect;
4
begin
5
  Windows.GetWindowRect(GetDesktopWindow, rDesktop);
6
  Windows.GetWindowRect(FindWindow('Shell_TrayWnd', nil), rWinBar);
7
  SubtractRect(Result, rDesktop, rWinBar);
8
end;

Hugs!