BigTyme 1,350 exp About a year ago


Label jgj = new Label("12345", 1, 2);
jgj.AutoSize = true;
Debug.Print("case C-the width is " + jgj.Width.ToString());
jgj.Text = "1234567890";
Debug.Print("case D-the width is Now " + jgj.Width.ToString());


THIS GIVES AN EXCEPTION & EVEN IN THE DEBUGGER .WIDTH THROWS AN EXCEPTION---WHY

BigTyme 1,350 exp About a year ago

This is strange..a workaround? Why does it work?

            Label jgj = new Label("12345",fntCalibri32, 1, 2);
Debug.Print("case C-the width is " + jgj.Width.ToString());
jgj.AutoSize = true;
jgj.Text = "123456789012345";
Debug.Print("case D-the width is " + jgj.Width.ToString()); // WIDTH UPDATE FAILS!!!
jgj.Width = 0; //NEEDED OR WIDTH CALC FAILS !!!
jgj.AutoSize = true; //Must be inclded here & occurr AFTER width=0, for width to recalc !!!

Debug.Print("case E-the width is " + jgj.Width.ToString()); // WIDTH UPDATE WORKS!!