1
런타임시 이미지 여백을 설정할 때 xaml 코드를 통해 설정하면 이상합니다.이미지 여백 동작
여백 값을 (40, 16, 0, 0)으로하고 싶습니다.
image1.Source = GetSlidePart(PresentationDocument.Open(path, false), 0, "rId2");
과 : 내가 XAML에서 이미지를 추가 할 때
System.Windows.Controls.Image proba = new System.Windows.Controls.Image();
ImageSource imageSource = GetSlidePart(PresentationDocument.Open(path, false), 0, "rId2");
proba.Source = imageSource;
proba.Width = 2245721/9525;
proba.Height = 2286004/9525;
proba.Margin = new Thickness(40, 16, 0, 0);
gridName.Children.Add(proba);
그러나이, CS의 코드는 이것이다 : 나는 런타임에 추가
, 내 코드는 이것이다 내 프로그램을 실행하면 내가 원하는 곳 image1에 정확히이다,
<Window x:Class="GetInfoFromPptxFile.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="720" Width="960">
<Grid Name="gridName">
<Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="416,20,0,0" Name="button1" VerticalAlignment="Top" Width="75" Click="button1_Click" />
<Image Height="150" HorizontalAlignment="Left" Margin="40,16,0,0" Name="image1" Stretch="Fill" VerticalAlignment="Top" Width="200" />
</Grid>
</Window>
및 proba라는 이미지가되지 않습니다 : XAML 코드는 이것이다. 왜 내가 그들에게 동일한 마진 값을 줄 때 이것은 무엇입니까?
이보다 더 많은 정보가 필요합니다. 당신이 원하는 것과 얻을 수있는 것의 이미지. 또한 : 마법은'proba.Width = 2245721/9525;'무엇입니까? ... XAML 버전에 누락되었습니다. –
원본 이미지가 동일합니다. 높이와 너비도 중요하지 않습니다. 동일한 너비와 높이를 설정하려고했는데 문제가 남아 있습니다. –