http://bugzilla.novell.com/show_bug.cgi?id=440191
http://bugzilla.novell.com/show_bug.cgi?id=440191#c5 Kenneth Skovhede <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] Severity|Normal |Major --- Comment #5 from Kenneth Skovhede <[email protected]> 2010-07-12 19:15:48 UTC --- When setting the size of a single line textbox, the size is saved internally, including the height. This occurs regardless of the Multiline property value. If Multiline is false, the control will report the visible size of the control instead of the internal size. When setting the Multiline property to true, the control reports the internal size. The following example explains this: TextBox t = new TextBox(); //Default, Multiline = false Console.WriteLine(t.Height); //Returns 20 under windows, similar under Mono t.Height = 200; Console.WriteLine(t.Height); //Returns 20 under windows, similar under Mono t.Multiline = true; Console.WriteLine(t.Height); //Returns 200 under window, returns the old small value under Mono! t.Multiline = false; Console.WriteLine(t.Height); //Returns 20 under windows, similar under Mono When the resource manager sets the size first and then the Multiline property, the control is not correctly updated, due to the above. Since the resource manager uses a Hashtable with property keys, the order in which the properties are applied is not the same as expected, which means that the bug is triggered. I think this could lead to other subtle errors, although it should not. Unfortunately there is no easy way to retrieve the localized property values directly, but it is possible to re-apply the values from the resource manager: new System.ComponentModel.ComponentResourceManager(typeof(...formname...)).ApplyResources(t, t.Name); This fixes the problem because the Multiline is now true, so the resource manager can set the size without problems. It is not possible to set the Multiline property before the resource manager runs, because the resource manager is activated within the Initialize() code generated by the Windows.Forms designer, and any changes would be lost on form edit. It is fairly difficult to read out the correct size from the resource manager after initialization, which leads me to belive that the above is the best solution. I will add a simple workaround that traverses all controls in the form and re-applies the resource manager, which can be activated after the Initialize() call has completed. -- 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. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
