C++开发uwp的坑
来源:互联网 发布:淘宝网店开店流程 编辑:程序博客网 时间:2024/06/05 16:53
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid x:Name="MyGrid">
</Grid>
</Grid>
Button^ bt;
bt = ref new Button();
//控件必须初始化 ref new ;
//也可以 写在同一行
//auto bt= ref new Button();
auto btn = ref new Button();
btn->Content = "an niu ";
btn->FontSize = 48;
btn->Foreground = ref new SolidColorBrush(Colors::Blue);
btn->Background = ref new SolidColorBrush(Colors::LightGreen);
btn->HorizontalAlignment = Windows::UI::Xaml::HorizontalAlignment::Center;
//click速度慢于tapped
btn->Tapped += ref new Windows::UI::Xaml::Input::TappedEventHandler(this, &App2::MainPage::OnTapped);
auto tx = ref new TextBlock();
//tx->HorizontalAlignment = Windows::UI::Xaml::HorizontalAlignment::Right;
tx->TextWrapping = Windows::UI::Xaml::TextWrapping::WrapWholeWords;
tx->TextAlignment = TextAlignment::Left;
//tx->OpticalMarginAlignment = OpticalMarginAlignment::None;
tx->Text = "TEXT";
tx->FontSize = Add(10, 38);
tx->Margin =Windows::UI::Xaml::Thickness(100.f);
tx->Foreground = ref new SolidColorBrush(Colors::PaleVioletRed);
MyGrid->Children->Append(tx);
MyGrid->Children->Append(btn);
void App2::MainPage::OnTapped(Platform::Object ^sender, Windows::UI::Xaml::Input::TappedRoutedEventArgs ^e)
{
((Button^)sender)->Background = ref new SolidColorBrush(Colors::LightCyan);
((Button^)sender)->Foreground = ref new SolidColorBrush(Colors::Red);
auto fileopenpicker = ref new FileOpenPicker();
fileopenpicker->SuggestedStartLocation = PickerLocationId::DocumentsLibrary;
fileopenpicker->FileTypeFilter->Append(".pdf");
//fileopenpicker->CommitButtonText = "打开";//默认值是 打开
fileopenpicker->CommitButtonText = "是否tap你需要的文档,并确定";
fileopenpicker->ViewMode = PickerViewMode::List;
fileopenpicker->PickMultipleFilesAsync();
}
<Grid x:Name="MyGrid">
</Grid>
</Grid>
Button^ bt;
bt = ref new Button();
//控件必须初始化 ref new ;
//也可以 写在同一行
//auto bt= ref new Button();
tx->Margin =Windows::UI::Xaml::Thickness(100.f);
auto btn = ref new Button();
btn->Content = "an niu ";
btn->FontSize = 48;
btn->Foreground = ref new SolidColorBrush(Colors::Blue);
btn->Background = ref new SolidColorBrush(Colors::LightGreen);
btn->HorizontalAlignment = Windows::UI::Xaml::HorizontalAlignment::Center;
//click速度慢于tapped
btn->Tapped += ref new Windows::UI::Xaml::Input::TappedEventHandler(this, &App2::MainPage::OnTapped);
auto tx = ref new TextBlock();
//tx->HorizontalAlignment = Windows::UI::Xaml::HorizontalAlignment::Right;
tx->TextWrapping = Windows::UI::Xaml::TextWrapping::WrapWholeWords;
tx->TextAlignment = TextAlignment::Left;
//tx->OpticalMarginAlignment = OpticalMarginAlignment::None;
tx->Text = "TEXT";
tx->FontSize = Add(10, 38);
tx->Margin =Windows::UI::Xaml::Thickness(100.f);
tx->Foreground = ref new SolidColorBrush(Colors::PaleVioletRed);
MyGrid->Children->Append(tx);
MyGrid->Children->Append(btn);
void App2::MainPage::OnTapped(Platform::Object ^sender, Windows::UI::Xaml::Input::TappedRoutedEventArgs ^e)
{
((Button^)sender)->Background = ref new SolidColorBrush(Colors::LightCyan);
((Button^)sender)->Foreground = ref new SolidColorBrush(Colors::Red);
auto fileopenpicker = ref new FileOpenPicker();
fileopenpicker->SuggestedStartLocation = PickerLocationId::DocumentsLibrary;
fileopenpicker->FileTypeFilter->Append(".pdf");
//fileopenpicker->CommitButtonText = "打开";//默认值是 打开
fileopenpicker->CommitButtonText = "是否tap你需要的文档,并确定";
fileopenpicker->ViewMode = PickerViewMode::List;
fileopenpicker->PickMultipleFilesAsync();
}
阅读全文
0 0
- C++开发uwp的坑
- UWP之C++/CX开发
- UWP开发:自定义Behavior的使用
- Win10的UWP开发之Hello World
- 讲讲我在Windows10(uwp)开发中遇到的一些坑
- UWP开发入门系列笔记之(零):UWP的前世今生
- 【UWP开发】uwp应用安装失败
- UWP-C#-关键字
- Win10/UWP开发-Ink
- Win10 UWP 开发教程
- Win 10 UWP开发系列:设置AppBarButton的图标
- Win10/UWP开发:让你的App使用上扫描仪
- Win10 UWP 开发系列:支持异步的SQLite
- Win 10 UWP开发系列:设置AppBarButton的图标
- UWP开发笔记——嵌套式页面的实现
- 适用于UWP应用开发的开源React Native插件
- Win10开发之UWP控件的隐藏空间
- 【UWP开发】如何获取win10和xbox one的用户信息
- LeetCode编程练习
- 谷歌扩展程序开发常用工具(Develop Tools)
- LeetCode编程练习
- antrl4学习(三)——用idea实现简单计算器
- LeetCode编程练习
- C++开发uwp的坑
- LeetCode编程练习
- Android——WiFi类
- 父子上下文的关系以及对子上下文容器中Action进行AOP(事务)的思想 (important)
- Chrome像 Firefox/IE 一样拖拉收藏网页
- 同一个文件Linux环境下和windows环境下md5_file处理出来的结果不一致
- VodeoCapture读取.avi视频报错
- DispatcherServlet 特殊的bean
- 集合框架知识点(全)