WPF 重复图像背景

标签 wpf background

我使用 C# 和 WPF 构建我的项目。在我的应用程序中,我使用了小尺寸的图像 (25x25) 作为我的应用程序背景。我从互联网上找到了一些示例,当我尝试时,我的应用程序的背景就像 imageA。但我想做的是我的背景就像 imageB 一样。有谁知道如何使它像imageB?

我的 WPF 代码片段:

<Grid>
    <Grid.Background>
        <VisualBrush TileMode="Tile" Viewport="0.8,0.8,0.1,0.1"  AlignmentX="Left" AlignmentY="Top">
            <VisualBrush.Visual>
                <Image Source="/Wpf_Customer;component/bg.jpg"></Image>
            </VisualBrush.Visual>
        </VisualBrush>
    </Grid.Background>

    <RadioButton Content="Graph" Name="dsad" FontSize="15" ></RadioButton>

</Grid>

图像A:

enter image description here

图像B:

enter image description here

编辑:

图像C:

enter image description here

最佳答案

尝试一下

 <ImageBrush x:Key="SimpleBitmap" ImageSource="Assets\BitmapImage.png" TileMode="FlipY"      Stretch="Uniform"AlignmentY="Top" Viewport="0,0,10,10" ViewportUnits="Absolute" />

其中 BitmapImage Width = 10,BitmapImage Height = 10

关于WPF 重复图像背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13910867/

相关文章:

c# - 如何在后台运行Unity程序?

Java:如何在双缓冲区下绘制游戏背景?

CSS 按用户更改背景颜色

wpf - WPF 应用程序中的菜单/工具栏颜色

c# - WPF:程序集解析器

wpf - Caliburn.Micro - 当 View 可见时做一些事情

C# WPF - 绑定(bind)到 DataGrid 中的父 ViewModel 不起作用

c# - 需要创建一个事件处理程序,可以在事件发生时自行删除

ios - AudioQueueStart 在 iOS 7 的后台进程中失败并显示 -16981

ios - 应用程序进入后台时显示启动画面