当前位置: 首页>>代码示例>>C#>>正文


C# Media.ImageBrush类代码示例

本文整理汇总了C#中Windows.UI.Xaml.Media.ImageBrush的典型用法代码示例。如果您正苦于以下问题:C# ImageBrush类的具体用法?C# ImageBrush怎么用?C# ImageBrush使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ImageBrush类属于Windows.UI.Xaml.Media命名空间,在下文中一共展示了ImageBrush类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnNavigatedTo

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            產生手寫軌跡的測試資料();
            solidColorBrush1 = new SolidColorBrush(ColorsHelper.Parse("ff1a1a1a"));
            solidColorBrush2 = new SolidColorBrush(ColorsHelper.Parse("ff999999"));
            solidColorBrush3 = new SolidColorBrush(ColorsHelper.Parse("ffff0000"));
            solidColorBrush4 = new SolidColorBrush(ColorsHelper.Parse("ff006cff"));
            solidColorBrush5 = new SolidColorBrush(ColorsHelper.Parse("ff0da522"));

            wbContentImage = BitmapFactory.New(768, 1024);
            wbContentImage.Clear(Colors.Transparent);
            cnUsingWriteableBitmap.Source = wbContentImage;


            d2dBrush = new ImageBrush();
            cnUsingGeometries.Background = d2dBrush;

            // Safely dispose any previous instance
            // Creates a new DeviceManager (Direct3D, Direct2D, DirectWrite, WIC)
            deviceManager = new DeviceManager();

            shapeRenderer = new ShapeRenderer();
            DisplayInformation DisplayInformation = Windows.Graphics.Display.DisplayInformation.GetForCurrentView();
            int pixelWidth = (int)(cnUsingGeometries.Width * DisplayInformation.LogicalDpi / 96.0);
            int pixelHeight = (int)(cnUsingGeometries.Height * DisplayInformation.LogicalDpi / 96.0);

            d2dTarget = new SurfaceImageSourceTarget(pixelWidth, pixelHeight);
            d2dBrush.ImageSource = d2dTarget.ImageSource;
            imgUsingInkManager.Source = d2dTarget.ImageSource;

            // Add Initializer to device manager
            deviceManager.OnInitialize += d2dTarget.Initialize;
            deviceManager.OnInitialize += shapeRenderer.Initialize;

            // Render the cube within the CoreWindow
            d2dTarget.OnRender += shapeRenderer.Render;

            // Initialize the device manager and all registered deviceManager.OnInitialize 
            deviceManager.Initialize(DisplayProperties.LogicalDpi);

            // Setup rendering callback
            //CompositionTarget.Rendering += CompositionTarget_Rendering;

            // Callback on DpiChanged
            DisplayProperties.LogicalDpiChanged += DisplayProperties_LogicalDpiChanged;

            #region Scenario1
            Scenario1Drawing = new Scenario1ImageSource((int)cnUsingDirectXs.Width, (int)cnUsingDirectXs.Height, true);

            // Use Scenario1Drawing as a source for the Ellipse shape's fill
            cnUsingDirectXs.Background = new ImageBrush() { ImageSource = Scenario1Drawing };
            #endregion
        }
开发者ID:vulcanlee,项目名称:Windows8Lab,代码行数:55,代码来源:MainPage.xaml.cs

示例2: OnNavigatedTo

        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.  The Parameter
        /// property is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            d2dDragHandler = new DragHandler(d2dCanvas) { CursorOver = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.SizeAll, 1) };

            d2dBrush = new ImageBrush();
            d2dRectangle.Fill = d2dBrush;

            effectRenderer = new EffectRenderer();

            deviceManager = new DeviceManager();

            int pixelWidth = (int)(d2dRectangle.Width * DisplayProperties.LogicalDpi / 96.0);
            int pixelHeight = (int)(d2dRectangle.Height * DisplayProperties.LogicalDpi / 96.0);

            d2dTarget = new SurfaceImageSourceTarget(pixelWidth, pixelHeight);
            d2dBrush.ImageSource = d2dTarget.ImageSource;
            d2dTarget.OnRender += effectRenderer.Render;

            deviceManager.OnInitialize += d2dTarget.Initialize;
            deviceManager.OnInitialize += effectRenderer.Initialize;
            deviceManager.Initialize(DisplayProperties.LogicalDpi);

            var window = CoreWindow.GetForCurrentThread();
            if (window.Visible)
                BindRenderingEvents();

            window.VisibilityChanged += (_, args) =>
                                        {
                                            if (args.Visible)
                                                BindRenderingEvents();
                                            else
                                                UnbindRenderingEvents();
                                        };
        }
开发者ID:MaybeMars,项目名称:SharpDX-Samples,代码行数:39,代码来源:MP-SIS.xaml.cs

示例3: ItemContainerGenerator_ItemsChanged

        private void ItemContainerGenerator_ItemsChanged(object sender, ItemsChangedEventArgs e)
        {
            if (e.Action == 1)
            {
                Position item = lstPositions.Items.Last() as Position;
                layers = new MapLayer();
                image = new BitmapImage();
                image.UriSource = (new Uri(SelectedFriend.Picture, UriKind.Absolute));

                grid = new Grid();
                grid.DataContext = item;
                grid.RightTapped += grid_RightTapped;
                textBlock = new TextBlock();
                textBlock.Text = item.Counter.ToString();
                textBlock.VerticalAlignment = VerticalAlignment.Bottom;
                textBlock.HorizontalAlignment = HorizontalAlignment.Center;
                brush = new ImageBrush();
                brush.ImageSource = image;
                ellipse = new Ellipse();
                ellipse.Height = 100;
                ellipse.Width = 100;
                ellipse.Fill = brush;
                grid.Children.Add(ellipse);
                grid.Children.Add(textBlock);
                layers.Children.Add(grid);
                MapLayer.SetPosition(grid, new Location(item.Latitude, item.Longitude));
                myMap.Children.Add(layers);
            }
        }
开发者ID:JorgeCupi,项目名称:SmartGuard,代码行数:29,代码来源:FriendInfoView.xaml.cs

示例4: MediaPlayer

        public MediaPlayer()
        {

            this.InitializeComponent();
            ImageBrush IBbackground = new ImageBrush();
            BitmapImage bmpBack = new BitmapImage(new Uri("ms-appx:///Assets/backG.jpg"));
            IBbackground.ImageSource = bmpBack;
            grBackGround.Background = IBbackground;

            ImageBrush IBback01 = new ImageBrush();
            BitmapImage bmpBack01 = new BitmapImage(new Uri("ms-appx:///Assets/back01.jpg"));
            IBback01.ImageSource = bmpBack01;
            grBack01.Background = IBback01;

            ImageBrush IBback02 = new ImageBrush();
            BitmapImage bmpBack02 = new BitmapImage(new Uri("ms-appx:///Assets/back2.jpg"));
            IBback02.ImageSource = bmpBack02;
            grBack02.Background = IBback02;

            ImageBrush IBback03 = new ImageBrush();
            BitmapImage bmpBack03 = new BitmapImage(new Uri("ms-appx:///Assets/back3.jpg"));
            IBback03.ImageSource = bmpBack03;
            grBack03.Background = IBback03;

            cbSite.Items.Add("mp3.zing.vn");
            cbSite.Items.Add("nhaccuatui.com");

            myMedia.MediaEnded += media_MediaEnded;
        }
开发者ID:bak301,项目名称:WinRT_Calendar,代码行数:29,代码来源:MediaPlayer.xaml.cs

示例5: setBrush

 private ImageBrush setBrush()
 {
     image = new BitmapImage(new Uri("ms-appx:///Assets/bomb-30x31.png"));
     ImageBrush imageb = new ImageBrush();
     imageb.ImageSource = image;
     return imageb;
 }
开发者ID:BilelAvans,项目名称:BallDrive,代码行数:7,代码来源:BombNPC.cs

示例6: OnNavigatedTo

        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.  The Parameter
        /// property is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            var imageBrush = new ImageBrush();
            imageBrush.ImageSource = _sisWrapper;
            rectangle.Fill = imageBrush;

            _sisWrapper.BeginDraw();

            var context = new SharpDX.Direct2D1.DeviceContext(new IntPtr(_sisWrapper.GetDeviceContext()));
            context.Clear(new SharpDX.Color4(0.4f, 0.3f, 0.15f, 1.0f));

            var random = new Random();
            for (int i = 0; i < 20; ++i)
            {
                var brush = new SharpDX.Direct2D1.SolidColorBrush(context, new SharpDX.Color4(
                    (float)random.NextDouble(),
                    (float)random.NextDouble(),
                    (float)random.NextDouble(),
                    1.0f));

                var left = (float)(250.0f * random.NextDouble());
                var top = (float)(250.0f * random.NextDouble());
                context.FillRectangle(new SharpDX.RectangleF(
                    left, top, left + 50.0f, top + 50.0f),
                    brush);
            }

            _sisWrapper.EndDraw();
        }
开发者ID:tpetrina,项目名称:directx-xaml-w8-wp8,代码行数:34,代码来源:MainPage.xaml.cs

示例7: TiledBackground

        public TiledBackground()
        {
            this.backgroundImageBrush = new ImageBrush();
            this.Background = backgroundImageBrush;

            this.SizeChanged += TiledBackground_SizeChanged;
        }
开发者ID:Myfreedom614,项目名称:UWP-Samples,代码行数:7,代码来源:TiledBackground.cs

示例8: OnNavigatedTo

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            item = e.Parameter as Eventos;
            if (item.Nombre != null)
                nombre.Text = item.Nombre;
            if (item.Fecha != null)
                fecha.Text = item.Fecha;
            if (item.Hora != null)
                hora.Text = item.Hora;
            if (item.Lugar != null)
                lugar.Text = item.Lugar;
            if (item.Descripcion != null)
                descri.Text = item.Descripcion;

            if (item.Foto != null)
            {
                ImageBrush brush = new ImageBrush();
                brush.Stretch = Stretch.UniformToFill;

                BitmapImage image = new BitmapImage(new Uri(item.Foto));
                brush.ImageSource = image;

                foto.Fill = brush;
            }
        }
开发者ID:vivianaraujo,项目名称:DejandoHuella,代码行数:25,代码来源:EventoPage.xaml.cs

示例9: setBrush

 private ImageBrush setBrush(string uriPath)
 {
     image = new BitmapImage(new Uri(uriPath));
     ImageBrush imageb = new ImageBrush();
     imageb.ImageSource = image;
     return imageb;
 }
开发者ID:BilelAvans,项目名称:BallDrive,代码行数:7,代码来源:Item.cs

示例10: Render

        public override Rectangle Render()
        {
            Rectangle rectangle = new Rectangle();

            //rectangle.ManipulationMode = ManipulationModes.All;
            //rectangle.ManipulationDelta += rectangle_ManipulationDelta;
            //rectangle.Tapped += rectangle_Tapped;

            ParentCanvas.ManipulationMode = ManipulationModes.All;
            ParentCanvas.ManipulationDelta += rectangle_ManipulationDelta;
            ParentCanvas.Tapped += rectangle_Tapped;

            rectangle.StrokeThickness = 3;
            rectangle.Height = Utility.SPRITE_HEIGHT;
            rectangle.Width = Utility.SPRITE_WIDTH;
            _participant = rectangle;

            ImageBrush ib = new ImageBrush();
            ib.ImageSource = new BitmapImage(new Uri("ms-appx:/Assets/ship 90x60.png", UriKind.RelativeOrAbsolute));
            _participant.Fill = ib;
            _participant.SetValue(Canvas.LeftProperty, _position.X);
            _participant.SetValue(Canvas.TopProperty, _position.Y);

            return _participant;
        }
开发者ID:bramom,项目名称:Bug.RS,代码行数:25,代码来源:Ship.cs

示例11: OnNavigatedTo

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            item = e.Parameter as Fundacion;
            if (item.Nombre != null)
                nombre.Text = item.Nombre;
            if (item.Direccion != null)
                direccion.Text = item.Direccion;
            if (item.Correo != null)
                correo.Text = item.Correo;
            if (item.Telefono != null)
                telefono.Text = item.Telefono;
            if (item.Cuenta_bancaria != null)
                cuentaBancaria.Text = item.Cuenta_bancaria;

            if (item.Descripcion != null)
                descri.Text = item.Descripcion;

            if (item.Foto != null)
            {
                ImageBrush brush = new ImageBrush();
                brush.Stretch = Stretch.UniformToFill;

                BitmapImage image = new BitmapImage(new Uri(item.Foto));
                brush.ImageSource = image;

                foto.Fill = brush;
            }
        }
开发者ID:vivianaraujo,项目名称:DejandoHuella,代码行数:28,代码来源:FundacionPage.xaml.cs

示例12: getPhoto_Click

        async void getPhoto_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(previousDays.Text))
                return;

            using (var client = new HttpClient())
            {
                var fullBingUrl = string.Format("{0}{1}", bingUrlPrefix, previousDays.Text);
                var xmlString = await client.GetStringAsync(new Uri(fullBingUrl));

                var doc = XDocument.Parse(xmlString);

                var imageUrlElement = doc
                    .Descendants("image")
                    .Descendants("url")
                    .FirstOrDefault();

                if (imageUrlElement != null)
                {
                    var imageUrl = imageUrlElement.Value;
                    var imageBrush = new ImageBrush();
                    imageBrush.ImageSource = new BitmapImage(new Uri("http://www.bing.com/" + imageUrl));                    
                    mainGrid.Background = imageBrush;
                }
            }
        }
开发者ID:kimsk,项目名称:WinAppThai,代码行数:26,代码来源:MainPage.xaml.cs

示例13: LoadState

        protected override void LoadState(Object navigationParameter, Dictionary<String, Object> pageState)
        {
            Random random = new Random();
            Uri uri = new Uri("ms-appx:///Assets/background_" + random.Next(1,7) +".jpg", UriKind.RelativeOrAbsolute);
            ImageBrush background = new ImageBrush();
            background.ImageSource = new BitmapImage(uri);
            this.SplitPage_Main_Grid.Background = background;
            var group = SampleDataSource.GetGroup((String)navigationParameter);
            this.DefaultViewModel["Group"] = group;
            this.DefaultViewModel["Items"] = group.Items;

            if (pageState == null)
            {
                this.itemListView.SelectedItem = null;
                if (!this.UsingLogicalPageNavigation() && this.itemsViewSource.View != null)
                {
                    this.itemsViewSource.View.MoveCurrentToFirst();
                }
            }
            else
            {
                if (pageState.ContainsKey("SelectedItem") && this.itemsViewSource.View != null)
                {
                    var selectedItem = SampleDataSource.GetItem((String)pageState["SelectedItem"]);
                    this.itemsViewSource.View.MoveCurrentTo(selectedItem);
                }
            }
        }
开发者ID:solome,项目名称:STUDENT.HELPER,代码行数:28,代码来源:SplitPage.xaml.cs

示例14: LoadData

        public async void LoadData(IEnumerable<XElement> sprites, StorageFile spriteSheetFile, string appExtensionId)
        {
            var bitmapImage = new BitmapImage();
            using (var stream = await spriteSheetFile.OpenReadAsync()) {
                await bitmapImage.SetSourceAsync(stream);
            }
            
            //xaml
            List<ImageListItem> listOfImages = new List<ImageListItem>();
            foreach (var sprite in sprites) {
                var row = int.Parse(sprite.Attributes("Row").First().Value);
                var col = int.Parse(sprite.Attributes("Column").First().Value);

                var brush = new ImageBrush();
                brush.ImageSource = bitmapImage;
                brush.Stretch = Stretch.UniformToFill;
                brush.AlignmentX = AlignmentX.Left;
                brush.AlignmentY = AlignmentY.Top;
                brush.Transform = new CompositeTransform() { ScaleX = 2.35, ScaleY = 2.35, TranslateX = col * (-140), TranslateY = row * (-87) };
                listOfImages.Add(new ImageListItem() {
                    Title = sprite.Attributes("Title").First().Value,
                    SpriteSheetBrush = brush,
                    File = sprite.Attributes("File").First().Value,
                    AppExtensionId = appExtensionId
                });
            }
            lbPictures.ItemsSource = listOfImages;
        }
开发者ID:liquidboy,项目名称:X,代码行数:28,代码来源:ImagePicker.xaml.cs

示例15: seleccionarImagen

        private async void seleccionarImagen(object sender, RoutedEventArgs e)
        {
            FileOpenPicker picker = new FileOpenPicker();
            picker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
            picker.FileTypeFilter.Add(".png");
            file = await picker.PickSingleFileAsync();

            BitmapImage image = new BitmapImage();
            try
            {
                using (var stream = await file.OpenAsync(FileAccessMode.Read))
                {
                    await image.SetSourceAsync(stream);
                }
                ImageBrush brush = new ImageBrush();
                brush.Stretch = Stretch.UniformToFill;
                brush.ImageSource = image;
                imagen.Fill = brush;
            }
            catch (Exception exception)
            {

            }
            
        }
开发者ID:wgcarvajal,项目名称:HuellitaW10,代码行数:25,代码来源:AgregarFotoMascotaPage.xaml.cs


注:本文中的Windows.UI.Xaml.Media.ImageBrush类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。