I just started learning WPF , which is why such a simple and naive question. There is a project with a graphical interface on WPF . On the main window of the program there is a button with an icon. My task was to tear out the picture and transfer it to another project. I was horrified that I could not find the file in the structure of the solution. The icon is made using the Path tag. Is there a way to export this drawing to a png file?
- oneDear Expert! Please follow this link: slovari.yandex.ru/~%D0%BA%D0%BD%D0%B8%D0%B3%D0%B8/… - yapycoder
|
1 answer
The drawing that has already been made in XAML (using Path) is correct as XAML and saved. So you can always reuse it in any other WPF project. In addition, you can 1) convert XAML to SVG or AI, if you want to insert it somewhere else in vector format, 2) convert it to PNG, JPG, GIF, etc., if you need to insert it somewhere else in raster view.
You can install Expression Blend, Illustrator or InkScape - they all understand XAML (for Illustrator you need a plugin) and process the image there.
Example.
Picture as XAML:
<?xml version="1.0" encoding="UTF-8"?> <Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Name="svg2" Width="100" Height="100"> <Canvas.Resources/> <Canvas Name="layer1"> <Canvas> <Canvas.RenderTransform> <TransformGroup> <!--g--> <TranslateTransform X="0" Y="-952.36218"/> </TransformGroup> </Canvas.RenderTransform> <Rectangle xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Canvas.Left="26" Canvas.Top="979" Width="46" Height="47" Name="rect3003" Fill="#0000FF" Stroke="#FF000000" StrokeThickness="1" StrokeLineJoin="Miter" StrokeStartLineCap="Flat" StrokeEndLineCap="Flat"/> </Canvas> </Canvas> </Canvas> Picture as png:

Made in InkScape.
- The fact of the matter is that it is necessary not in the wpf project. Is it possible to do without expression using VS? - yapycoder 2:17 pm
- In a simple case, you can take a screenshot, in the complex you need some kind of editor. - Nicolas Chabanovsky ♦
|