2

我想知道如何访问受保护的方法。

我有一个 WebBrowser Control (Awesomium),它有许多受保护的方法。

我在 WinForm 中使用此 WebControl 创建了一个选项卡式浏览器。

现在我不能使用 ie InjectKeyboard-method 因为它受到保护。

这是方法:

//     Injects a keyboard event.
//
// Parameter:
//   keyEvent:
//     The keyboard event to inject. You'll need to initialize the members of the
//     passed Awesomium.Core.WebKeyboardEvent, yourself.
//
// Note:
//      Awesomium.Windows.Forms.WebControl handles this internally. Inheritors do
//     not need to call this method unless they implement custom logic.  This method
//     bypasses settings of the Awesomium.Windows.Forms.WebControl.InputController.
//      For performance reasons, no validity check is performed when calling protected
//     members.  Inheritors should perform any such checks (see Awesomium.Windows.Forms.WebControl.IsLive),
//     before calling these members.

protected void InjectKeyboardEvent(WebKeyboardEvent keyEvent);

虽然在 API 链接在这里

他们为什么要保护这种方法,我该如何使用它?

4

1 回答 1

2

如果需要,从此类继承并公开该方法(如方法上方的注释所建议的那样)。

于 2011-12-04T16:49:54.857 回答