首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >了解Windows 10何时为平板电脑模式- Windows 10 / Windows 10 Mobile

了解Windows 10何时为平板电脑模式- Windows 10 / Windows 10 Mobile
EN

Stack Overflow用户
提问于 2015-10-09 22:54:46
回答 2查看 1.3K关注 0票数 3

我的工作是Windows 10和Windows 10 Mobile的通用应用程序。有人知道如何检查Windows 10是否在平板电脑模式下运行吗?

我在这里发现了这个问题,但这是针对Windows Forms的:How can I detect when Window 10 enters tablet mode in a Windows Forms application?

谢谢

EN

回答 2

Stack Overflow用户

发布于 2015-10-09 23:07:14

You query the UserInteractionMode -这是来自该链接的示例代码

代码语言:javascript
复制
switch(UIViewSettings.GetForCurrentView().UserInteractionMode)
{
  case UserInteractionMode.Mouse:
    VisualStateManager.GoToState(this, "MouseLayout", true);
    break;

  case UserInteractionMode.Touch:
  default:
    VisualStateManager.GoToState(this, "TouchLayout", true);
    break;
}
票数 5
EN

Stack Overflow用户

发布于 2020-11-20 01:15:44

我认为下面的代码可以帮助你:

代码语言:javascript
复制
UIViewSettings^ uiViewSettings = UIViewSettings::GetForCurrentView();
UserInteractionMode mode = uiViewSettings->UserInteractionMode;
switch (mode)
{
case UserInteractionMode::Touch:
  // PC is in tablet mode or other touch-first environment
  break;

case UserInteractionMode::Mouse:
  // PC is not in tablet mode or other mouse-first environment
  break;
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33041370

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档