Wie bekomme ich den aktuellen Pfad eines Bildes in wpf?Aktuellen Bildpfad erhalten
Ich versuche, eine generische Funktion zu erstellen, die das Bild in ein anderes Bild ändert, indem Sie einfach einen "Fokus" am Ende des Namens des Bildes, btu scheint nicht den aktuellen Pfad zu bekommen, so dass ich machen kann die Änderung
keine Idee?
EDIT:
private void image1_MouseEnter(object sender, MouseEventArgs e)
{
string buf = ((BitmapImage)(sender as Image).Source).UriSource.ToString();
string pack = buf.Substring(0, buf.LastIndexOf('.')) + "focus" + buf.Substring(buf.LastIndexOf('.'));
SetImageFullURI(sender as Image, pack);
}
EDIT 2:
<Window x:Class="Jode_NumeroDePeito.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="493" Width="1019" UseLayoutRounding="True" Loaded="Window_Loaded">
<Grid>
<Border BorderBrush="#FFEBEBEB" BorderThickness="1" Height="207" HorizontalAlignment="Left" Margin="16,11,0,0" Name="border1" VerticalAlignment="Top" Width="206" CornerRadius="5"></Border>
<Image Height="38" HorizontalAlignment="Left" Margin="27,33,0,0" Name="btPastaArtes" Stretch="None" VerticalAlignment="Top" Width="261" Source="/Jode_NumeroDePeito;component/Images/botao.jpg" SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="NearestNeighbor" MouseEnter="image1_MouseEnter" MouseLeave="imgEscolherArtes_MouseLeave" Cursor="Hand" />
<Image Cursor="Hand" Height="21" HorizontalAlignment="Left" Margin="52,19,0,0" Name="image1" RenderOptions.BitmapScalingMode="NearestNeighbor" SnapsToDevicePixels="True" Source="/Jode_NumeroDePeito;component/Images/passo1.jpg" Stretch="None" VerticalAlignment="Top" Width="97" />
<Border BorderBrush="#FFEBEBEB" BorderThickness="1" CornerRadius="5" Height="207" HorizontalAlignment="Left" Margin="16,233,0,0" Name="border2" VerticalAlignment="Top" Width="206" />
<Image Cursor="Hand" Height="38" HorizontalAlignment="Left" Margin="27,255,0,0" Name="btCSV" RenderOptions.BitmapScalingMode="NearestNeighbor" SnapsToDevicePixels="True" Source="/Jode_NumeroDePeito;component/Images/botao.jpg" Stretch="None" VerticalAlignment="Top" Width="261" MouseEnter="image1_MouseEnter" MouseLeave="imgEscolherArtes_MouseLeave" />
<Image Cursor="Hand" Height="21" HorizontalAlignment="Left" Margin="52,241,0,0" Name="image3" RenderOptions.BitmapScalingMode="NearestNeighbor" SnapsToDevicePixels="True" Source="/Jode_NumeroDePeito;component/Images/passo2.jpg" Stretch="None" VerticalAlignment="Top" Width="97" />
<Border BorderBrush="#FFEBEBEB" BorderThickness="1" Height="429" HorizontalAlignment="Left" Margin="237,11,0,0" Name="border3" VerticalAlignment="Top" Width="338" AllowDrop="False" CornerRadius="5"></Border>
<Image Cursor="Hand" Height="21" HorizontalAlignment="Left" Margin="265,19,0,0" Name="image2" RenderOptions.BitmapScalingMode="NearestNeighbor" SnapsToDevicePixels="True" Source="/Jode_NumeroDePeito;component/Images/passo3.jpg" Stretch="None" VerticalAlignment="Top" Width="97" />
<TextBlock Height="136" HorizontalAlignment="Left" Margin="29,74,0,0" Name="txtLogArtes" Text="" VerticalAlignment="Top" Width="181" />
<TextBlock Height="136" HorizontalAlignment="Left" Margin="29,295,0,0" Name="txtLogCSV" Text="" VerticalAlignment="Top" Width="181" />
<Image Cursor="Hand" Height="16" HorizontalAlignment="Left" Margin="564,161,0,0" Name="lblPreset" RenderOptions.BitmapScalingMode="NearestNeighbor" SnapsToDevicePixels="True" Source="/Jode_NumeroDePeito;component/Images/configIllustrator.jpg" Stretch="None" VerticalAlignment="Top" Width="116" />
<ComboBox Height="16" HorizontalAlignment="Left" Margin="552,172,0,0" Name="selPreset" VerticalAlignment="Top" Width="132" />
<Image Cursor="Hand" Height="16" HorizontalAlignment="Left" Margin="729,161,0,0" Name="lblInit" RenderOptions.BitmapScalingMode="NearestNeighbor" SnapsToDevicePixels="True" Source="/Jode_NumeroDePeito;component/Images/inicio.jpg" Stretch="None" VerticalAlignment="Top" Width="116" />
<TextBox Height="16" HorizontalAlignment="Left" Margin="686,172,0,0" Name="txtInit" VerticalAlignment="Top" Width="120" />
<Image Cursor="Hand" Height="16" HorizontalAlignment="Left" Margin="816,161,0,0" Name="lblQnt" RenderOptions.BitmapScalingMode="NearestNeighbor" SnapsToDevicePixels="True" Source="/Jode_NumeroDePeito;component/Images/qnt.jpg" Stretch="None" VerticalAlignment="Top" Width="116" />
<TextBox Height="16" HorizontalAlignment="Left" Margin="808,172,0,0" Name="txtQnt" VerticalAlignment="Top" Width="120" />
<Border BorderBrush="#FFEBEBEB" BorderThickness="1" CornerRadius="5" Height="45" HorizontalAlignment="Left" Margin="544,153,0,0" Name="pnGeneric" VerticalAlignment="Top" Width="429" Visibility="Hidden" />
<Image Cursor="Hand" Height="30" HorizontalAlignment="Left" Margin="930,163,0,0" Name="imgFechar" RenderOptions.BitmapScalingMode="NearestNeighbor" SnapsToDevicePixels="True" Source="/Jode_NumeroDePeito;component/Images/x.jpg" Stretch="None" VerticalAlignment="Top" Width="35" />
<Image Cursor="Hand" Height="38" HorizontalAlignment="Left" Margin="249,33,0,0" Name="btAdd" RenderOptions.BitmapScalingMode="NearestNeighbor" SnapsToDevicePixels="True" Source="/Jode_NumeroDePeito;component/Images/adic.jpg" Stretch="None" VerticalAlignment="Top" Width="261" />
<Border BorderBrush="Silver" BorderThickness="0" Height="357" HorizontalAlignment="Left" Margin="242,75,0,0" Name="pnContainer" VerticalAlignment="Top" Width="329" />
<Image Cursor="Hand" Height="21" HorizontalAlignment="Left" Margin="611,19,0,0" Name="image4" RenderOptions.BitmapScalingMode="NearestNeighbor" SnapsToDevicePixels="True" Source="/Jode_NumeroDePeito;component/Images/passo3.jpg" Stretch="None" VerticalAlignment="Top" Width="97" />
<Image Cursor="Hand" Height="38" HorizontalAlignment="Left" Margin="595,33,0,0" Name="btImprimir" RenderOptions.BitmapScalingMode="NearestNeighbor" SnapsToDevicePixels="True" Source="/Jode_NumeroDePeito;component/Images/adic.jpg" Stretch="None" VerticalAlignment="Top" Width="261" />
<TextBlock Height="168" Margin="636,241,210,0" Name="txtLog" Text="TextBlock" VerticalAlignment="Top" />
</Grid>
</Window>
Dank,
Joe
Wo kommt dieses Bild in erster Linie kommen? –
wird normalerweise beim Designer hinzugefügt – Jonathan
Wie wird es hinzugefügt? Als Ressource? Inhalt? –