[Mono-bugs] [Bug 600826] New: wrong control location is returned if control is invisible and was moved with Anchor = AnchorStyles.Right

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Apr 29 05:28:00 EDT 2010


http://bugzilla.novell.com/show_bug.cgi?id=600826

http://bugzilla.novell.com/show_bug.cgi?id=600826#c0


           Summary: wrong control location is returned if control is
                    invisible and was moved with Anchor =
                    AnchorStyles.Right
    Classification: Mono
           Product: Mono: Runtime
           Version: 2.6.x
          Platform: All
        OS/Version: Windows 7
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: misc
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: jm at grassau.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64;
Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729;
Media Center PC 6.0; MDDC)

I created a button which is invisible and anchored to its container with
Button1.Anchor = AnchorStyles.Right. When I resize the container, the old
location is returned for the control. Only when the control is made visible,
the right location is returend.


Reproducible: Always

Steps to Reproduce:
1. Create a form ("Form1") with a button control ("Button1") on it.

2. Enter the following VB Code the Sub New of Form1:

    Button1.SetBounds(100, 100, 100, 100)
    Button1.Anchor = AnchorStyles.Right
    Button1.Visible = False
    Me.Width += 100
    MsgBox(Button1.Left.ToString)
    Button1.Visible = True
    MsgBox(Button1.Left.ToString)

3. Run the program.
Actual Results:  
If run with Mono, the MsgBox first shows 100, then 200.
If run in VS 2008 without Mono, the MsgBox shows 200, then again 200.

Expected Results:  
MsgBox should always show 200, because when Form1.Width is changed, the
location of Button1 should immediately be changed too, regardless of its
visibility.

The same mistake (MsgBox "100" and "200" instead of "200" and "200") occurs
when testing other location or size variables, e.g. when using
AnchorStyles.Bottom, changing Me.Height, and testing Button1.Top: 

    Button1.SetBounds(100, 100, 100, 100)
    Button1.Anchor = AnchorStyles.Bottom
    Button1.Visible = False
    Me.Height += 100
    MsgBox(Button1.Top.ToString)
    Button1.Visible = True
    MsgBox(Button1.Top.ToString)

It also occurs when using "AnchorStyles.Left Or AnchorStyles.Right", changing
Me.Width, and testing Button1.Width: 

    Button1.SetBounds(100, 100, 100, 100)
    Button1.Anchor = AnchorStyles.Left Or AnchorStyles.Right
    Button1.Visible = False
    Me.Width += 100
    MsgBox(Button1.Width.ToString)
    Button1.Visible = True
    MsgBox(Button1.Width.ToString)

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list