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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with delphi forms and A laptop WXGA lcd screen!

Status
Not open for further replies.

EmilianM

Programmer
Feb 15, 2007
4
FR
I recently bought an laptop with 17” WXGA lcd. I have a problem with Delphi 7.0 Profesional and my notebook WXGA resolution. (aspect 16:9,the standard resolution is 1440x900). The labels are changing their positions in the forms (the top and left properties), the forms are changing their size. I have the same problem if I use a standard 4:3 resolution (for ex : 1024x768 ). Does anyone have any idea about this problem ?
 
Your Delphi apps can obtain and change the screen resolution (and other info) using functions like these.
Once you know the resolution you can then move and resize things as you require.
If your problem is using the Delphi GUI at at design time, I dont know if there is anything you can do.

Code:
// Test all screen resolutions 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 [The sane]: Delphi a feersum engin indeed.
 
I work in Delphi GUI at at design time and I have some forms with lots of labels, images, etc ...and they look like hell. on the new WXGA screen. I wonder if somebody has this problem and if it knows a patch for Delphi (or form my video drivers?!!?) ?
 
its not a good programming practice to change the users screen res to suit your app."

Even if I use the "old and good" 1024x768 on the my new notebook with WXGA screen I have the same problem!!This is my big PROBLEM :)!
 
I have to point out that I wasn't suggesting that he change the resolution, but he can find out what it is. So he can re-scale correctly. The functions come as set, and show how to use enumdisplaysettings() to get the video information.

its not a good programming practice to change the users screen res to suit your app.

I haven't seen many (any) full screen games that don't change the screen resolution.
The code snippets I posted are used in some of mine.
Sometimes as with a game its unavoidable.
The important thing to remember if you do have to change the res, is to change it back when the application closes.






Steve [The sane]: Delphi a feersum engin indeed.
 
Sggaunt I don't think I was very clear...or I don’t understand what are you want to tell me...

I have an old project that has a form with lots of labels, shapes and images. This form was "made" in GUI designer and it looks perfect on an normal monitor with 1024x768 resolution and an 4:3 aspect ratio. If I copy this project on a new computer that have an wide LCD with the aspect ratio 16:9 and if I set the same resolution(1024x768) and I try to open the project and the form with Delphi some position and size properties are changed and the form looks very bad.
In my opinion this is not normal!!!
 
i tried it on my crt and had no problems.

delphi stayed to the left
my app stayed where i last left it.

have you tried loading 1 of the demo apps to see if its something you have set on your form.

Aaron
 
Try setting your desktop properties to a resolution that matches the aspect ratio of YOUR laptop monitor. I have a 17" WXGA LCD set at 1680 x 1050. My Delphi IDE and forms look great (albeit small text) Open ms-paint and draw a large circle. If it's not round, you may have a driver issue.

Roo
Delphi Rules!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top