System.Windows.Controls.TextBox手柄 [英] System.Windows.Controls.TextBox Handle

查看:237
本文介绍了System.Windows.Controls.TextBox手柄的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我觉得我失去了一些东西真的很明显这里。

I feel like I'm missing something really obvious here.

我知道,形式一般有一个处理属性,但我使用的是 System.Windows.Controls.TextBox 并没有一个处理属性。

I know that forms in general have a Handle property, but I am using a System.Windows.Controls.TextBox and it does not have a Handle property.

我如何访问文本框的处理?我注意到的RichTextBox 的Handle属性,那么为什么不正规文本框

How do I access the TextBox's handle? I noticed that RichTextBox has the Handle property, so why not the regular TextBox?

推荐答案

<打击>您只需拨打的处理上的文本框。距离 System.Windows.Forms.Control的继承的属性。

You can just call Handle on the TextBox. It is an inherited property from System.Windows.Forms.Control.

编辑:问题进行了更新,询问WPF

WPF不使用像一个典型的Win32应用程序或WinForms应用程序句柄。每个控件是不是在WPF其自己的窗口。您可以验证这一点与间谍++,它无法控制每一个区分。因此,你不能SendMessage函数到各个控件,如你可以与WinForms和的Win32应用程序。

WPF doesn't use handles like a typical Win32 application or WinForms application. Each control is not its own Window in WPF. You can verify this with Spy++, it cannot differentiate between each control. Therefore you cannot SendMessage to the individual controls like you can with WinForms and Win32 apps.

您可以使用 WindowInteropHelper 获得WPF窗口的父窗口的句柄。

You can use WindowInteropHelper to get the parent window handle of a WPF window.

这篇关于System.Windows.Controls.TextBox手柄的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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