程序不完整,if (!SelectingText && this.SelectionLength > 0)中的this是什么东西?应该是自定义的控件吧,SelectionLength应该是用户定义的属性,你跟踪一下,我怀疑在这一句代码中SelectionLength的值为null,所以引发了异常。解决办法,检查SelectionLength赋值的地方,保证在这一句代码前赋值,或者为SelectionLength属性设置默认值为0