C++开发uwp的坑

 <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <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 h = ref new Windows::Web::Http::HttpClient();
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
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值