Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
作成したグリッドに画像が表示されない理由がわかりません
Image img = new Image(); img.Source = new BitmapImage(new Uri(@"C:\logo.bmp", UriKind.Relative)); img.Width = 50; img.Height = 50; img.Margin = new Thickness(5, 5, 5, 5); grid1.Children.Add(img);
画像 URI は絶対パスです。
あなたは書くべきです
img.Source = new BitmapImage(new Uri(@"C:\logo.bmp", UriKind.Absolute));
またはそれ以上
img.Source = new BitmapImage(new Uri(@"C:\logo.bmp"));