在WPF设计界面工具箱拖拽一个TextBox进去,
textBox1.Text = "中国你好";
Rect rect1 = textBox1.GetRectFromCharacterIndex(textBox1.Text.Length);rect1不为空。但一旦我new一个TextBox出来,然后用相同的方法,为什么Rect为空呢??
代码如下:TextBox tb = new TextBox();
tb.Text="中国ABC";
Rect rect2 = tb.GetRectFromCharacterIndex(tb.Text.Length);怎么解释呢?