如何获得屏幕大小?

时间:2012-10-30 18:56:39

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

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

1 个答案:

答案 0 :(得分:2)

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

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

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