<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                - [圓形頭像](#) - [去掉黑邊](#) - [拖動打開圖形](#) ## 圓形頭像 現在很多軟件都喜歡使用圓形頭像 win10 uwp使用圓形頭像很簡單 ~~~ <Ellipse Width="200" Height="200" Margin="10,10,10,10"> <Ellipse.Fill> <ImageBrush ImageSource="assets/1.jpg"/> </Ellipse.Fill> </Ellipse> ~~~ 使用這樣的圓形頭像沒有對原有圖形的渲染大小進行變化,一個大的圖形不會解碼為剛好要的,我們進行一步修改 代碼: ~~~ <Page x:Class="Roundhead.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:Roundhead" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"> <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> <StackPanel Orientation="Vertical"> <Ellipse Width="200" Height="200" Margin="10,10,10,10"> <Ellipse.Fill> <ImageBrush ImageSource="assets\1.jpg"/> </Ellipse.Fill> </Ellipse> <TextBlock Text="我的頭像是圓" HorizontalAlignment="Center" /> </StackPanel> </Grid> </Page> ~~~ ![圓形頭像](https://box.kancloud.cn/2016-04-08_570763684a5bd.jpg "") ## 去掉黑邊 程序界面有一些 ![程序界面有一些](https://box.kancloud.cn/2016-04-08_5707636866e38.jpg "") 看起來不好 在app.xaml.cs找到`this.DebugSettings.EnableFrameRateCounter = true;` 寫為`false` ![this.DebugSettings.EnableFrameRateCounter = false;](https://box.kancloud.cn/2016-04-08_57076368861f1.jpg "") ## 拖動打開圖形 把`<ImageBrush ImageSource="assets\1.jpg"/>`添加`x:Name="ximg"` 在Grid增加`AllowDrop="True" DragOver="Grid_DragOver" Drop="Grid_Drop"` 在`Grid_Drop` ~~~ private async void Grid_Drop(object sender , DragEventArgs e) { var defer = e.GetDeferral(); try { DataPackageView dataView = e.DataView; // 拖放類型為文件存儲。 if (dataView.Contains(StandardDataFormats.StorageItems)) { var files = await dataView.GetStorageItemsAsync(); StorageFile file = files.OfType<StorageFile>().First(); if (file.FileType == ".png" || file.FileType == ".jpg") { // 拖放的是圖片文件。 BitmapImage bitmap = new BitmapImage(); await bitmap.SetSourceAsync(await file.OpenAsync(FileAccessMode.Read)); ximg.ImageSource = bitmap; } } } finally { defer.Complete(); } } ~~~ 在`Grid_DragOver` ~~~ private void Grid_DragOver(object sender , DragEventArgs e) { //需要using Windows.ApplicationModel.DataTransfer; e.AcceptedOperation = DataPackageOperation.Copy; // 設置拖放時顯示的文字。 //e.DragUIOverride.Caption = "拖放打開"; // 是否顯示拖放時的文字。默認為 true。 //e.DragUIOverride.IsCaptionVisible = false; // 是否顯示文件預覽內容,一般為文件圖標。默認為 true。 // e.DragUIOverride.IsContentVisible = false; // Caption 前面的圖標是否顯示。默認為 true。 //e.DragUIOverride.IsGlyphVisible = false; //需要using Windows.UI.Xaml.Media.Imaging; //設置拖動圖形,覆蓋文件預覽 //e.DragUIOverride.SetContentFromBitmapImage(new BitmapImage(new Uri("ms-appx:///Assets/1.jpg"))); e.Handled = true; } ~~~ ![這里寫圖片描述](https://box.kancloud.cn/2016-04-08_57076368abe06.jpg "") `e.AcceptedOperation = DataPackageOperation.Copy;`設置拖動作為復制 需要`using Windows.ApplicationModel.DataTransfer` 拖放顯示文字`e.DragUIOverride.Caption = "拖放打開";` ![這里寫圖片描述](https://box.kancloud.cn/2016-04-08_57076368e387e.jpg "") 是否顯示拖放時的文字。默認為 true`e.DragUIOverride.IsCaptionVisible = false;` ![這里寫圖片描述](https://box.kancloud.cn/2016-04-08_570763691e3cf.jpg "") 復制圖標是否顯示 `e.DragUIOverride.IsGlyphVisible = false;` ![這里寫圖片描述](https://box.kancloud.cn/2016-04-08_570763693f2f1.jpg "") 設置拖動圖形,覆蓋文件預覽`e.DragUIOverride.SetContentFromBitmapImage(new BitmapImage(new Uri(img)));` ![這里寫圖片描述](https://box.kancloud.cn/2016-04-08_570763695f20f.jpg "") 代碼:[https://code.csdn.net/lindexi_gd/lindexi_gd/tree/master/Roundhead](https://code.csdn.net/lindexi_gd/lindexi_gd/tree/master/Roundhead) 參考:[http://timheuer.com/blog/archive/2015/05/06/making-circular-images-in-xaml-easily.aspx](http://timheuer.com/blog/archive/2015/05/06/making-circular-images-in-xaml-easily.aspx)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看