[Lazarus] Obtaining screen geometry
Graeme Geldenhuys
graemeg.lists at gmail.com
Wed Jun 23 10:39:28 CEST 2010
On 23 June 2010 10:28, Alexander Grau wrote:
>
> // always keep space around the window for dock panels (OSX/Win7 etc.)
> // this is the desired size (considering the space around the window)
> w:=round(screen.width - 150);
> h:=round(screen.height - 150);
In stead of using a "magic number" of 150, it would be better to query
the underlying OS directly. Obviously this is not portable, but we
have done this under Windows. Querying the width or height of the
taskbar, and subtract that from the screens size.
But then you can have a multi-monitor system too, so now Screen size
and Desktop size differs too... ;-)
> // this calculates the best size keeping aspect
> CalcResizeKeepAspect(1024, 768, w, h);
> height:=max(600, h);
> width:=max(800, w);
And don't for get the Golden Ratio for window sizes: 1.618
http://en.wikipedia.org/wiki/Golden_ratio
--
Regards,
- Graeme -
_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
More information about the Lazarus
mailing list