Jymmy097 wrote:
Hi,Found the solution in the samples. Here is how they do it:
It still not work: it says that "Calls stack contains only external code. You have to disable 'only user code' and load symbols to view the origin of this path (or somehting similar: I have VS in Italian).
If I disable Just My code, it says that PresentatinFramework.pdb wasn't loaded.
C:\Windows\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework\v4.0_4.0.0.0__31bf3856ad364e35\PresentationFramework.pdb: Unable to open or read the file PDB.
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PresentationFramework.pdb: Unable to open or read the file PDB.
C:\Windows\symbols\dll\PresentationFramework.pdb: Unable to open or read the file PDB.
C:\Windows\dll\PresentationFramework.pdb: Unable to open or read the file PDB.
C:\Windows\PresentationFramework.pdb: Unable to open or read the file PDB.
And then I stop the execution.
This is the code I use:
WriteableBitmap bmp = BitmapFactory.New(1, 1);and this is the XAML code:public MainWindow() { InitializeComponent(); bmp.FromResource("Image\\Tulips.jpg"); }
<Window x:Class="Test45.MainWindow"</Window>xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="900" Width="1366"> <Grid> <Button Content="Button" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Width="75" Click="Button_Click_1"/> <Image HorizontalAlignment="Left" Height="768" Margin="90,10,0,0" VerticalAlignment="Top" Width="1024"/> </Grid>
What's going on?
Thanks a lot.
Jymmy097
EDIT: I tried to add Tulips.jpg to one of the sample project and to load it using FromResource method.
This Window appeared:
http://snap.ashampoo.com/sGDY16Ai
It tells me to Find the origin of WriteableBitmapConvertExtensions.cs.
And If I do that, it tells me that Imust use BeginInit and EndInit or something similar because he couldn't find BitmapSource.
EDIT2:
I used this code:
bmp = BitmapFactory.New(1, 1).FromResource("Image\Tulips.jpg");
instead of this:
bmp.FromResource("Image\Tulips.jpg");
it tells me "Missing origin informations into debug informations for this module".
WriteableBitmap LoadBitmap(string path)
{
var img = new BitmapImage();
img.BeginInit();
img.CreateOptions = BitmapCreateOptions.None;
var s = Application.GetResourceStream(new Uri(path, UriKind.Relative)).Stream;
img.StreamSource = s;
img.EndInit();
return BitmapFactory.ConvertToPbgra32Format(img);
}