zoukankan      html  css  js  c++  java
  • WPF Image Source 路径4种常用方式

    
    
    <Window
        x:Class="WpfApp1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:local="clr-namespace:WpfApp1"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        Title="MainWindow"
        Width="800"
        Height="450"
        mc:Ignorable="d">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
            <Button Grid.Row="0">
                <Image Source="img/a.png" />
            </Button>
            <Button Grid.Row="1">
    
                <Image Source="/WpfApp1;component/img/a.png" />
            </Button>
            <Button Grid.Row="2">
                <StackPanel>
                    <TextBlock Text="pack Url" />
                    <Image Source="pack://application:,,,/img/a.png" />
                </StackPanel>
            </Button>
            <Button Grid.Row="3">
                <StackPanel>
                    <TextBlock Text="pack Url 引用别的程序集资源" />
                    <Image Source="pack://application:,,,/WpfApp1;component/img/a.png" />
                </StackPanel>
            </Button>
        </Grid>
    </Window>

  • 相关阅读:
    返回图片宽高比
    3.1/3.2图片上传类
    php获取图片的拍摄及其他数据信息
    上传类
    pathinfo()的用法
    上传并压缩图片
    将数组转化为键值对
    css3判断某个li标签
    禁止滚动条/启用滚动条
    Keepalived + haproxy双机高可用方案
  • 原文地址:https://www.cnblogs.com/houzf/p/15029986.html
Copyright © 2011-2022 走看看