【问题标题】:How do I get the size of the screen?我如何获得屏幕的大小?
【发布时间】:2012-10-20 04:44:59
【问题描述】:

我想知道屏幕的宽度,以便在 Win8 应用中设置弹出窗口的宽度。

【问题讨论】:

  • 你是说屏幕的“宽度”吗?

标签: c++ xaml windows-8 windows-runtime c++-cx


【解决方案1】:

假设您指的是屏幕的高度和宽度(或者更准确地说是应用程序窗口的高度和宽度),您可以从 Window.Bounds 获得该值

例如,下面是按钮后面的代码,它将在该窗口的文本框中显示当前窗口的宽度:

void App68::MainPage::Button_Click_1(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
    txtWidth->Text = Window::Current->Bounds.Width.ToString();
}

【讨论】:

  • 不知道Window.Bounds.Windows::UI::Xaml::Window::Bounds怎么用??
  • 谢谢,Jim。C++ 对我来说很难。我喜欢 C#= =
  • 因为我想学directx3D。我和我的同学想开发一个小游戏引擎。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2023-03-15
  • 1970-01-01
  • 2014-09-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多