日期:2014-05-18  浏览次数:20951 次

请高手看看这段代码执行的顺序,谢谢
一个程序中的片段,我单步执行了一下,顺序很乱,不是我原来想的那样,请问是怎么回事?

C# code
 void txtBox_Enter(object sender, EventArgs e)
        {
           
            if (((SWF.TextBox)sender).Multiline)
            {
                orgtext = ((SWF.TextBox)sender).Text;
            }

            if (!((SWF.TextBox)sender).ReadOnly)
            {
                ((SWF.TextBox)sender).Clear();

                ((SWF.TextBox)sender).Multiline = false;
                ((SWF.TextBox)sender).BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            }
        }


------解决方案--------------------
纠正
if(txt.ReadOnly)
-->
if(!txt.ReadOnly)