Link to home
Start Free TrialLog in
Avatar of db2trade
db2trade

asked on

Drawing outside form

Hi,

Is it possible to draw outside form ? Usually we use form in a normal Delphi application. I just want to know if I can draw a RECTANGLE (for example) outside the form.

I need to utilize all the screen area (depends on the screen resolution, for example 1024 x 768, position 0,0 will be in the topleft, 1023, 767 in the downright).

Thanks
Avatar of DragonSlayer
DragonSlayer
Flag of Malaysia image

sure...

drawing on the desktop:

procedure TForm1.Button1Click(Sender: TObject);
var C: TCanvas;
   DeskTopWindowDC: HDC;
begin
 C:=TCanvas.Create;
 with C do
  try
   DeskTopWindowDC:=GetWindowDC(GetDeskTopWindow);
   try
    Handle:=DeskTopWindowDC;
    Brush.Color:=clBlue;
    FillRect(Rect(0, 0, 100, 100));
   finally
    ReleaseDC(GetDesktopWindow, DeskTopWindowDC);
   end;
  finally
    Free;
  end;
end;
Avatar of TOndrej
TOndrej

You can still use a form to utilize the whole screen.
Avatar of db2trade

ASKER

Hi DragonSlayer,

Thanks for your solution, one more question (I double the points for you), how can I save the screen (before drawing), and then restore it back (after drawing) ?

ASKER CERTIFIED SOLUTION
Avatar of DragonSlayer
DragonSlayer
Flag of Malaysia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
-> i thought you wanted to double the points? ;)

Happy programming!
DragonSlayer, let some points for us, too :)
hehehe... hi nick... still have no time to crash my machine with your code yet ;-)
Hehehe, yes, I doubled it :)
it was 25 ... and then I changed it to 50 :)
DragonSlayer, I will double too if will solve my taskbar problem :) That mean 1.000 points ;P
LoL ;)

have been sleeping for only 3 hours daily for the past 2-3 weeks... TIRED... once my deadline is met, I'll be back ;)
Long sleep is not good for health :) One hour is enough.  Or still to long ?
Joke :)