Go to GoReading for breaking news, videos, and the latest top stories in world news, business, politics, health and pop culture.

TDesktopCanvas - draw on Windows Desktop

106 9
This canvas class allows you to access the Windows Desktop, and draw on it.

~~~~~~~~~~~~~~~~~~~~~~~~~
type
   TDesktopCanvas = class(TCanvas)
   private
     DC : hDC;
     function GetWidth:Integer;
     function GetHeight:Integer;
   public
     constructor Create;
     destructor Destroy; override;
   published
     property Width: Integer read GetWidth;
     property Height: Integer read GetHeight;
   end;

{ TDesktopCanvas object }
function TDesktopCanvas.GetWidth:Integer;
begin
   Result:=GetDeviceCaps(Handle,HORZRES) ;
end;

function TDesktopCanvas.GetHeight:Integer;
begin
   Result:=GetDeviceCaps(Handle,VERTRES) ;
end;

constructor TDesktopCanvas.Create;
begin
   inherited Create;
   DC := GetDC(0) ;
   Handle := DC;
end;

destructor TDesktopCanvas.Destroy;
begin
   Handle := 0;
   ReleaseDC(0, DC) ;
   inherited Destroy;
end;
~~~~~~~~~~~~~~~~~~~~~~~~~


Delphi tips navigator:
» Hiding Minimized MDI Child Windows
« Get Last Day in Month

Source...

Leave A Reply

Your email address will not be published.