WARNING: This server is unstable and will be retired in the next days. If you want to keep this forum available, please request immediately a migration on the Nabble Support forum. Forums that don't receive any migration request will be deleted forever.

 « Return to Thread: Screen positions vary with resolution

Re: Screen positions vary with resolution

by Benoît Minisini :: Rate this Message:

| View in Thread

Le 16/04/2012 09:10, Rolf-Werner Eilert a écrit :

> This is Gambas 2, a very old project of mine and yet a program that runs
> continuously on my desktop. Last week, I got a new monitor with a wider
> resolution, and now there is something going wrong.
>
> The program shows an overview of the rooms in the school with LTSP
> terminals, which one is switched on and where someone has logged in.
>
> When I programmed it, I used some frames to have an optical marking for
> the rooms. Then I used labels to display the numbers of the terminals
> and colors for their status.
>
> The form is fixed. The frames are of a fixed size. All sizes are in
> pixels, aren't they? Then I define the labels, for instance like this:
>
> FOR i = 0 TO 26
> ll = NEW Label(Form1)
> lbl.Add(ll)
> lbl[i].Text = CStr(i)
> lbl[i].BackColor = color.White
> lbl[i].Width = 40
> lbl[i].Height = 20
> lbl[i].Alignment = align.Center
> lbl[i].Font.Size = 11
> lbl[i].Font.Bold = TRUE
> SELECT CASE i
> CASE 0
> lbl[i].Visible = FALSE
> CASE 1, 3, 5, 7, 9, 11, 13
> lbl[i].X = 160
> lbl[i].Y = 20 + (i * 14)
> CASE 2, 4, 6, 8, 10, 12, 14
> lbl[i].X = 220
> lbl[i].Y = 20 + ((i - 1) * 14)
> CASE 15, 17, 19, 21, 23, 25
> lbl[i].X = 10
> lbl[i].Y = 15 + ((i - 13) * 15)
> CASE 16, 18, 20, 22, 24, 26
> lbl[i].X = 70
> lbl[i].Y = 15 + ((i - 14) * 15)
> END SELECT
> NEXT
>
> So all positions should be fixed. But with the higher screen resolution,
> the labels land on wrong positions. The frames appear as if they were
> slightly wider and higher now, and the labels land too much on the left
> and too high. Before, I had 1280x1024, now it's 1600x1200.
>
> Any explanation for this? I try to add a screenshot, hope the mailer
> doesn't reject it.
>
> Regards
>
> Rolf
>

By default all controls have a relative position and size (except the
one you create manually) that are proportional to the Desktop.Scale
property. I.e. they use the MoveScaled() method and not the Move() method.

Either set the (Scaled) form property to FALSE or do not use absolute
positions when creating your controls.

Regards,

--
Benoît Minisini

------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Gambas-user mailing list
Gambas-user@...
https://lists.sourceforge.net/lists/listinfo/gambas-user

 « Return to Thread: Screen positions vary with resolution