2 pixel displacement

Discussion in 'Questions (Windows Mobile)' started by specci48, Aug 29, 2007.

  1. specci48

    specci48 Well-Known Member Licensed User

    Hi,

    I am wondering about this strange behaviour:

    I have created a Form1 and added a Label1 with the designer. Label1 has the following properties:
    top = 50
    left = 100
    width = 50
    height = 20

    After that, I added this code:
    Code:
    Sub Globals
    End Sub

    Sub App_Start
       Form1.Show
       AddLabel(
    "Form1","Label2",50,Label1.Top,Label1.Width,Label1.Height,"Label2")
       AddLabel(
    "Form1","Label3",150,Label1.Top + 2,Label1.Width,Label1.Height,"Label3")
    End Sub
    If I start this code on the desktop, I can see (as shown in the attachment):
    - Label1 is the reference
    - Label2 is displaced (2 pixels HIGHER than Label1) :confused:
    - Label3 has the same top position as Label1 :confused:

    If I start that code on the device I'll get the (estimated) result:
    - Label1 is the reference
    - Label2 has the same top position as Label1
    - Label3 is displaced (2 pixels LOWER than Label1)

    So why does this happen on the desktop?


    specci48
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    It looks like the designer created and the manually created labels don't have the same font size.
    If you'll explicitly set the font size they should be properly aligned.
    It will be fixed in the next update.
     
  3. agraham

    agraham Expert Licensed User

    Interesting!

    If you set the background colours different to that of the form you can see that the labels are all in the correct position, it is the position of the text within the added labels that is different.

    A further peculiarity, on my system at least, is the the label added at design time with the default background colour has the same colour background as the form, whereas those added at runtime have a different, slightly darker background colour.
     
    Last edited: Aug 29, 2007
Loading...