导出 (0) 打印
全部展开
信息
您所需的主题如下所示。但此主题未包含在此库中。

CoreWindow Class

表示具有输入事件和基本用户界面行为的 Windows 应用商店应用程序。

语法


public sealed class CoreWindow : ICoreWindow

特性

[MarshalingBehavior(Standard)]
[Muse()]
[Version(0x06020000)]
[WebHostHidden()]

成员

CoreWindow类 具有这些类型的成员:

事件

CoreWindow类 具有这些事件。

事件说明
Activated Is fired when the window completes activation or deactivation.
AutomationProviderRequested Is fired when a request for an automation handler is generated.
CharacterReceived Is fired when a new character is received by the input queue.
Closed Is fired when the app terminates.
InputEnabled Occurs when input is enabled or disabled for the Windows Store app.
KeyDown Is fired when a non-system key is pressed.
KeyUp Is fired when a non-system key is released after a press.
PointerCaptureLost Occurs when a pointer moves to another Windows Store app.
PointerEntered Occurs when a pointer moves into the bounding box of the Windows Store app.
PointerExited Occurs when the pointer moves outside the bounding box of the Windows Store app.
PointerMoved Occurs when a pointer moves within the bounding box of the Windows Store app.
PointerPressed Occurs when a mouse button is clicked, or a touch or pen contact is detected, within the bounding rectangle of the Windows Store app.
PointerReleased Occurs when a mouse button is released, or a touch or pen contact is lifted, within the bounding rectangle of the Windows Store app.
PointerWheelChanged Occurs when the wheel button is rotated.
SizeChanged Is fired when the window size is changed.
TouchHitTesting Occurs when a touch contact area intersects the bounding rectangle (or polygon) of a window that is registered for touch hit testing.
VisibilityChanged Is fired when the window visibility is changed.

 

方法

The CoreWindow 类 具有这些方法。 它还继承方法于Object 类.

方法说明
Activate Activates the window.
Close Closes a secondary window and exits the message loop.
GetAsyncKeyState Returns the state of a virtual key asynchronously.
GetForCurrentThread Gets the CoreWindow instance for the currently active thread.
GetKeyState Gets the state of a key.
ReleasePointerCapture Disables pointer capture for the Windows Store app.
SetPointerCapture Enables pointer capture for the Windows Store app.

 

属性

CoreWindow类 具有这些属性。

属性访问类型说明

AutomationHostProvider

只读Gets the automation provider assigned to this window.

Bounds

只读Gets the bounding rectangle of the window.

CustomProperties

只读Gets the set of custom properties for the window.

Dispatcher

只读Gets the event dispatcher for the window.

FlowDirection

读/写Gets or sets the horizontal origin of the window's reading order alignment.

IsInputEnabled

读/写Gets or sets a value that indicates whether input is enabled for the Windows Store app.

IsKeyboardInputEnabled

读/写

KeyboardInputBuffer

读/写

PointerCursor

读/写Gets or sets the cursor used by the Windows Store app.

PointerPosition

只读Gets the client coordinates of the pointer.

Visible

只读Gets a value that indicates whether the window is visible.

 

备注

通过调用 CoreApplication.CreateNewView,然后检查返回的 CoreApplicationViewCoreWindow 属性,可以获得此类的新实例。或者您可以从 CoreApplication.Views 属性,或者通过调用 CoreWindow.GetForCurrentThread,为正在运行的应用程序获取现有 CoreWindow 实例,如以下示例所示。


void MyCoreWindowEvents::Run() // this is an implementation of IFrameworkView::Run() used to show context
{
    CoreWindow::GetForCurrentThread()->Activate();

    /...

    CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessUntilQuit);
}

注意  :此类不敏捷,这意味着您需要考虑其线程模型和封送行为。有关更多信息,请参见线程处理和封送处理 (C++/CX)

Windows Phone 8

只有本机应用程序支持此 API。

要求

最低支持客户端

Windows 8 [仅 Windows 应用商店应用程序]

最低支持服务器

Windows Server 2012 [仅 Windows 应用商店应用程序]

最低支持电话

Windows Phone 8 [仅限本机应用]

命名空间

Windows.UI.Core
Windows::UI::Core [C++]

元数据

Windows.winmd

另请参见

CoreApplicationView
CoreApplication.CreateNewView
CoreApplication.Views

 

 

显示:
© 2014 Microsoft