[Gambas-user] Screen positions vary with resolution

Rolf-Werner Eilert eilert-sprachen at ...221...
Mon Apr 16 09:10:31 CEST 2012


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: gambas4.png
Type: image/png
Size: 22519 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20120416/2bff6c90/attachment.png>


More information about the User mailing list