From: Erik B. <eb...@us...> - 2006-06-02 00:50:42
|
Update of /cvsroot/gexperts/gexperts/unstable/Src/Utils In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv11324/Src/Utils Modified Files: GX_GenericUtils.pas Log Message: Try to support more multi-monitor systems with nagative window positions Index: GX_GenericUtils.pas =================================================================== RCS file: /cvsroot/gexperts/gexperts/unstable/Src/Utils/GX_GenericUtils.pas,v retrieving revision 1.149 retrieving revision 1.150 diff -u -d -r1.149 -r1.150 --- GX_GenericUtils.pas 16 May 2006 01:25:15 -0000 1.149 +++ GX_GenericUtils.pas 1 Jun 2006 23:41:44 -0000 1.150 @@ -1679,33 +1679,34 @@ var Monitor: TMonitor; begin - Result.Top := 0; - Result.Left := 0; - Result.Right := Screen.Width; - Result.Bottom := Screen.Height; - if Assigned(Form) then - begin - Monitor := Screen.MonitorFromWindow(Form.Handle, mdNearest); - if Assigned(Monitor) then - Result := Monitor.WorkareaRect; - end - else - SystemParametersInfo(SPI_GETWORKAREA, 0, @Result, 0); + Result.Top := Screen.DesktopTop; + Result.Left := Screen.DesktopLeft; + Result.Right := Screen.DesktopWidth; + Result.Bottom := Screen.DesktopHeight; + + if Assigned(Form) then + begin + Monitor := Screen.MonitorFromWindow(Form.Handle, mdNearest); + if Assigned(Monitor) then + Result := Monitor.WorkareaRect; + end + else + SystemParametersInfo(SPI_GETWORKAREA, 0, @Result, 0); end; procedure EnsureFormVisible(const Form: TCustomForm); var - Rect: TRect; + Rect: TRect; begin - Rect := GetScreenWorkArea(Form); - if (Form.Left + Form.Width > Rect.Right) then - Form.Left := Form.Left - ((Form.Left + Form.Width) - Rect.Right); - if (Form.Top + Form.Height > Rect.Bottom) then - Form.Top := Form.Top - ((Form.Top + Form.Height) - Rect.Bottom); - if Form.Left < 0 then - Form.Left := 0; - if Form.Top < 0 then - Form.Top := 0; + Rect := GetScreenWorkArea(Form); + if (Form.Left + Form.Width > Rect.Right) then + Form.Left := Form.Left - ((Form.Left + Form.Width) - Rect.Right); + if (Form.Top + Form.Height > Rect.Bottom) then + Form.Top := Form.Top - ((Form.Top + Form.Height) - Rect.Bottom); + if Form.Left < Rect.Left then + Form.Left := Rect.Left; + if Form.Top < Rect.Top then + Form.Top := Rect.Top; end; procedure ConvertBitmapToIcon(const Bitmap: Graphics.TBitmap; Icon: TIcon); |