Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

fullscreen mode

Status
Not open for further replies.

MirceaVleju

Programmer
Oct 10, 2003
32
RO
Can anyone tell me how can i run a program in fullscreen mode?
 
What do you mean? Full screen command-line or make the form take up the full screen?
 
Its actually very easy.


Since you've been posting questions on this forum for about 2 years, I'll assume you can work out the necessary form properties that you need to set.

Once you've done that:

Code:
procedure TForm1.FormCreate(Sender: TObject);
begin

  BoundsRect := Screen.DesktopRect

end;

As I said very easy - just one line of code.
 
earthandfire will that work for all versions of Delphi?

This usualy works for me.
FrmMain.WindowState := wsmaximized;
Height := screen.Height;
width := screen.Width;


Steve: Delphi a feersum engin indeed.
 
sggaunt, I got rid of all versions of Delphi prior to 7 when I had a major software cd clear out about 6 months ago. Including MSDN (a total of over 700 cds), so I'm afraid I don't know.
 
I don't mean to be rude but that version using screen.x i had already known.It is accually very simple.What i meen is this:

I have a 1024*768 resolution. Now how can i make my program run in FullScreen on a 640*480 resolution. That is the big question.

Sorry if i didn't ask the right question.
 
No problem, just misunderstood your post

We are still working on this, an updated version that I dont have here also changes the monitor refresh rate. This can be changed for no apparent reason when setting other parameters.

Code:
// Test all screen ressolutions to see if the desired res can be obtained
// Colours is the desired colour depth in Bits.
function CanDisplayAt(Width, Height, Colours: Cardinal): boolean;
var i: integer;
    devmode: TDevMode;
begin
   i := 0;
   Result := false;
   while enumdisplaysettings(nil,i,devmode) do
      begin
        with devmode do
           if (dmpelswidth = Width) and (dmpelsheight = Height) and (dmbitsperpel = Colours) then
              begin
                 result := True;
                 exit;
              end;
        inc(i);
      end;
end;

// Colours is the desired colour depth in Bits.
function ChangeResolution(Width, Height, Colours: Cardinal): boolean;
var ScreenData: TDevMode;
begin
   if EnumDisplaySettings(nil, 1, ScreenData) then
       begin
          with screendata do
             begin
                dmPelsWidth  := Width;
                dmPelsHeight := Height;
                dmBitsPerPel := Colours;
                dmFields := dmFields or DM_PELSWIDTH;
                dmFields := dmFields or DM_PELSHEIGHT;
                dmfields:=  dmFields or DM_BITSPERPEL;
             end;
        end;
      if ChangeDisplaySettings(ScreenData, 0) = DISP_CHANGE_SUCCESSFUL then
         result := true
      else
         result := false;
   //  SendMessage(HWND_BROADCAST,WM_DISPLAYCHANGE,SPI_SETNONCLIENTMETRICS,0);
end;

Steve: Delphi a feersum engin indeed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top