imagebrush

Don't scale ImageBrush while resizing, Repeat it!

可紊 提交于 2019-12-21 04:52:47
问题 I have a problem with ImageBrush : <Window ... > <Grid> <Grid.Background> <ImageBrush ImageSource="Controls\Images\notebook_paper_Line.jpg" TileMode="FlipX" Viewport="0,0,1,0.09" /> </Grid.Background> </Grid> </Window> I want to repeat image while user resizing window. But currently image gets scale while user resizing window. (Note that image size is small and I use TileMode and Viewport to repeat it, And problem occurs while resizing it!). Any XAML code will be great! :) and i'm sorry for

ImageBrush throws exception when trying to set Window background

家住魔仙堡 提交于 2019-12-14 02:09:20
问题 I'm trying to set the background of my WPF window to an image but I'm getting this exception when I try to run it: A first chance exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll Additional information: 'Provide value on 'System.Windows.Baml2006.TypeConverterMarkupExtension' threw an exception.' Line number '8' and line position '10'. I don't want to add the image to the project, as I would like to be able to change the image at runtime. My

How to change Border Background image programmatically

爷,独闯天下 提交于 2019-12-12 01:07:21
问题 I am creating a media player app in WPF c#. I am using Media Element to do this. Anyways, I have used <Border> </Border> to add border some places. <Border Name="hej1"> <Border.Background> <ImageBrush ImageSource="Images\music.png" Stretch="None"/> </Border.Background> <MediaElement ..../> </Border> I want to change the ImageSource to some other picture programmatically, how to do that? I have tried but no success. So for every song the image in <ImageBrush ImageSource="Images\music.png" is

Fill texture brush using image, not tile

时光总嘲笑我的痴心妄想 提交于 2019-12-11 02:03:24
问题 I have a texture brush that uses a certain image to make the texture to be displayed like this: Image image = new Bitmap("Untitled.png"); for (int i = 0; i < points.Count; i++) { using (TextureBrush tbr = new TextureBrush(image)) { tbr.RotateTransform(i * 4); var p = PointToClient(Cursor.Position); tbr.Transform = new Matrix( 75.0f / 640.0f, 0.0f, 0.0f, 75.0f / 480.0f, 0.0f, 0.0f); e.Graphics.FillEllipse(tbr, p.X - 50, p.Y - 50, 100, 100); Pen p3 = new Pen(tbr); e.Graphics.DrawEllipse(Pens

Create imagebrush, bitmap and writeablebitmap from an url

你说的曾经没有我的故事 提交于 2019-12-08 19:26:23
问题 Hey I have a windows phone 8.1 app using the silverlight API. I am downloading this image from my blob storage. The image is coming from a link like this: https://[service].blob.core.windows.net/[imagename].png and the image can be showned and downloaded in multiple browsers, just using the URI. I now want to use this as a imagebrush based on the imageuri from the blobstorage: // If we have a returned SAS. BitmapImage myOnlineImage = new BitmapImage(); myOnlineImage.UriSource = new Uri

How to Use an image as ImageBrush on a Line or Path in WPF

拟墨画扇 提交于 2019-12-07 14:25:00
问题 I have a Canvas on which I draw lines (via Lines or Paths) that indicates a road to follow for users. Is there a way to change the line so that it displays a repetitive image instead? What I'm looking for is to have a step icon (png with transparency) instead of a straight line. Thanks! 回答1: This will draw a repeated image as Stroke for a Path . Laborate with the values of Viewport to achieve what you're looking for <Path StrokeThickness="10" Data="M 10,10 100,10" Stretch="Fill"> <Path.Stroke

How to Use an image as ImageBrush on a Line or Path in WPF

纵饮孤独 提交于 2019-12-06 02:29:27
I have a Canvas on which I draw lines (via Lines or Paths) that indicates a road to follow for users. Is there a way to change the line so that it displays a repetitive image instead? What I'm looking for is to have a step icon (png with transparency) instead of a straight line. Thanks! Fredrik Hedblad This will draw a repeated image as Stroke for a Path . Laborate with the values of Viewport to achieve what you're looking for <Path StrokeThickness="10" Data="M 10,10 100,10" Stretch="Fill"> <Path.Stroke> <ImageBrush ImageSource="C:\arrow.gif" Viewport="0,0,0.1,1" TileMode="Tile"/> </Path

Grid Background Image using ImageBrush

99封情书 提交于 2019-12-01 05:11:37
I wish to use an ImageBrush in XAML to apply a background to a Grid . I've given the brush a x:Key and want to refer to it in my grid. Sadly, it doesn't come up with the image as a background at all. <Window.Resources> <ImageBrush ImageSource="/MAQButtonTest;component/images/bird_text_bg.jpg" x:Key="BackgroundSponge" /> <Style TargetType="TextBlock"> <Setter Property="OverridesDefaultStyle" Value="True"/> </Style> <ControlTemplate TargetType="Button" x:Key="ButtonTemplate"> <Grid Width="444" ShowGridLines="False" SnapsToDevicePixels="True" Background="{DynamicResource BackgroundSponge}"> <Grid

Grid Background Image using ImageBrush

☆樱花仙子☆ 提交于 2019-12-01 03:05:59
问题 I wish to use an ImageBrush in XAML to apply a background to a Grid . I've given the brush a x:Key and want to refer to it in my grid. Sadly, it doesn't come up with the image as a background at all. <Window.Resources> <ImageBrush ImageSource="/MAQButtonTest;component/images/bird_text_bg.jpg" x:Key="BackgroundSponge" /> <Style TargetType="TextBlock"> <Setter Property="OverridesDefaultStyle" Value="True"/> </Style> <ControlTemplate TargetType="Button" x:Key="ButtonTemplate"> <Grid Width="444"