It seems like variations of this question have been asked before, but not this specifically. Also, it seems that BitmapImages
are different from straight Bitmaps
. So here we go:
I've got a BitmapImage x:Name="HeightMapImage"
that is pointing to an Image x:Name="image"
that is inside ContentPresenter x:Name="contentPresenter"
that is in Viewbox x:Name="viewBox"
. I want to draw both semi-transparently and non-transparently at specific X,Y coordinates on the HeightMapImage
.
The reason for this set-up is that the BitmapImage
is being scrolled and zoomed. When I draw on the BitmapImage
at X,Y I want that to automatically scroll and zoom, too.
I'm a very old geek having written for many machines in many different GDIs over the years. This seems like a 'get the handle' to some graphic device context problem and once I've got it I can merrily draw away.
Your help is greatly appreciated.
Somebody wanted to see the code. Here's the XAML
:
<Viewbox x:Name="viewBox" Margin="0,0,0,0">
<ContentPresenter x:Name="contentPresenter" Width="350" Height="350" >
<ContentPresenter.Content>
<Image x:Name="image" Width="350" Height="350">
<Image.Source>
<BitmapImage x:Name="HeightMapImage" UriSource="DinoIslandLogo.bmp" />
</Image.Source>
</Image>
</ContentPresenter.Content>
</ContentPresenter>
</Viewbox>
And here's a screen capture that somebody wanted:
And here's the code that gets the user's selected bitmap and loads and displays it:
string selectedFileName = dlg.FileName;
BitmapImage bitmap = new BitmapImage();
bitmap.BeginInit();
bitmap.UriSource = new Uri(selectedFileName);
bitmap.EndInit();
image.Source = bitmap;
Does this need to be rewritten for a Writeable Bitmap
?