how to display EMF/WMF image on WPF window.
Check out this thread. You won't like the answer. ;-)
http://social.msdn.microsoft.com/forums/en-US/wpf/thread/7010cefa-e596-45af-b193-40206451dd90/
Ab2d.ReaderWmf does exactly what you want - imports WMF image into WPF's Viewbox.
Related
I am working on a Silverlight application and my problem is like this: I have a StackPanel
and inside the stackpanel I have a ViewBox. Inside the viewbox I am adding images and rotating them 90 and/or -90 degrees.
When rotated, my images go out of the viewbox. How can I fix this?
Use something other than StackPanel, it doesn't resize.
There's a control in the Silverlight Toolkit that addresses this problem called the LayoutTransformer. It ensures that when you change the transform, the bounds of the control are within the LayoutTransformer bounds.
You can see this at work in the Silverlight Toolkit demo. Just scroll down the tree on the left to the Layout section.
How can I programmatically draw a bitmap to a WPF Canvas? (or should I do something else entirely?) I will have about 40 moving images.
If you need to dynamically create and modify bitmaps, then use a WritableBitmap. You can place these on a canvas.
I did something similar, but I wanted some logic on each image(object) so I created a UserControl with an image and just add the UserControl to the canvas.
Does anyone know what the background colour is for the jetpack theme??
http://www.silverlight.net/content/samples/sl4/themes/jetpack.html
We're using the theme, but I can't see that light silver background colour which has a gradient through it.
Actually if you create a new project based on the JetPack theme, you will see there is a user control called TiledBackground which does the repeating effect for you.
However, the dependency property ResourceUri of this user control is binding to a wrong image file by default, I believe, and that's why you only see a light colored background.
To have the same background as in the demo, you simply need to replace the image backgroundtexture.png in the Images folder with the image file that Joe has provided. Then in the MainPage.xaml, you need to make sure the SourceUri is binding to this image.
For example, I have replaced with Joe's image and still named it backgroundtexture.png, and my project name is JetPack.
<controls:TiledBackground SourceUri="/JetPack;component/Images/backgroundtexture.png" />
Then you should see the dark background as expected. :)
It's actually an image that is repeated. To get the same effect you'll have to write a custom control or effect that tiles the image. Here's the image.
And here's a sample of tiling an image.
http://nokola.com/blog/post/2009/12/22/Fast-Tile-Brush-in-Silverlight-And-Easiest-Way-to-Shader-Effects.aspx
I have noticed a bizzare situation - in SIlverlight, when a picture is rendered using WriteableBitmap Render method, the resulting pic is very sharp. Of course in WPF Render method is not available. I have used DrawingGroup to render two images on top of each other (I have got a png with transparency and standard JPEG). However in that case the resulting bitmap is not so sharp (especially in case of text).
Could you see any reasons for that? Have you faced such a problem?
Any ideas for the solution?
I need to 'put' a png with transparency on jpeg image and get a precise resulting pic.
Thank you in advance for the replies!
Cheers
Have you tried BitmapScalingMode on RenderOptions? It's an attached property that applies to most DependencyObjects that have anything to do with drawing images. An example:
<object Name="myObject" RenderOptions.BitmapScalingMode="HighQuality" .../>
or to do this in codebehind:
RenderOptions.SetBitmapScalingMode(myObject, BitmapScalingMode.HighQuality);
I want to make a WPF Grid in which users can drag and drop controls from one cell to another and when the user is dragging I need to draw tips on the screen, like arrows. It's as if the tips were in ANOTHER LAYER in the screen. That is, they are not drawn IN the grid I mentioned.
The problem is: I don't know how to OVERLAP a "transparent" canvas over my Grid so that I can draw on it.
Do you experienced guys have some tip? THANKS.
I think what you are looking for are Adorners. You can read something about them here:
http://marlongrech.wordpress.com/2008/02/28/wpf-overlays-or-better-adorner/
Heres an example with a listView control, pretty good.
Heres a tut also decent.
And even a section in msdn