SetProperty of"Text"控件类型不支持:窗口 [英] SetProperty of "Text" is not supported on control type: Window

查看:97
本文介绍了SetProperty of"Text"控件类型不支持:窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

标题提到我收到的错误消息.

The title mentions the error message I receive.

我的问题很简单:当所有搜索属性都与Webedit有关时,VS为什么会找到一个窗口.

My question is simply : why does VS find a window when all the searchproperties are about a Webedit.

            WinEdit txtObject = new WinEdit(cltObject);
            txtObject.SearchProperties.Add(WinEdit.PropertyNames.ControlType, "Edit");
            txtObject.SearchProperties.Add(WinEdit.PropertyNames.ControlName, "innerTextBox");
            txtObject.SearchProperties.Add(WinEdit.PropertyNames.ClassName, "WindowsForms10.EDIT.app.0.29531c8_r13_ad1");
            txtObject.SearchConfigurations.Add(SearchConfiguration.NextSibling);
            txtObject.SearchConfigurations.Add(SearchConfiguration.DisambiguateChild);
            txtObject.DrawHighlight();
            WinEdit txt = (WinEdit)txtObject;
            txt.Text = "test";

突出显示了正确的控件!也找到了父对象(cltObject)并按预期突出显示了

The correct control is highlighted! The parent object (cltObject) is also found and highlighted as expected.

添加了对WinEdit的强制转换,因为该错误消息指出他找到了Window.仍然没有区别,我仍然收到相同的错误消息. 

The casting to a WinEdit is added because of the error message stating that he finds a Window. Still no difference, I still get the same error message. 

推荐答案

我不明白最后两个步骤应该是什么做.您已经找到了drawObjectlight()函数所示的txtObject控件.那时候,为什么不直接分配文本:

I don't understand what the last two steps are supposed to be doing. You have found the txtObject control as shown by the drawhighlight() function. At that point, why don't you assign the text directly:

txtObject.Text =测试";

txtObject.Text = "test";


这篇关于SetProperty of"Text"控件类型不支持:窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆