New maintenance release with many improvements for metafile reader

by abenedik 20. April 2011 23:42

This release brings many improvements to almost all our products.

The metafile reader (Ab2d.ReaderWmf) library got most of the changes. The svg reader (Ab2d.ReaderSvg) also got a few new features. There were also some improvements that affected all the products except ZoomPanel. ZoomPanel control was left out of this release because the library is waiting for a major upgrade. Now when this release is out I will finally start working on it (many things are already prepared - like mini map, rotate the content, zoom slider, etc. - they just need to be polished and tested).

Let me first describe the changes that affected all the products (except ZoomPanel):

  • The licensing dialogs are now created in WPF and not in Windows Forms as before (this skips loading Windows Forms and other related assemblies and therefore speeds up the application start - especially in evaluation version).
  • Improved commercial license code that tries to find embedded resources - this code is now much faster.
  • Added splash screens to all of the converter applications.

Besides the changes above the Ab3d.Reader3ds and Ab3d.PowerToys libraries did not get any new features.

 

But as mentioned before the Ab2d.ReaderWmf library was improved quite significantly. The code that transformed positions data from metafile into WPF was rewritten from ground up. The new version now enables to specify in which units the read positions will be - they can be in Pixels, Millimeters, Inches or GdiCompatable units. This can be useful when the drawing for example in Microsoft Visio is created in millimeters, the WPF elements that are created with pasting the drawing into Paste2Xaml can be also defined in millimeters. When the default Pixel units are used, the size of the read metafile is now the same as the size that is shown when the metafile is opened by Windows.

This is the list of changes in Ab2d.ReaderWmf library:

  • Added MetafileUnits property. It specifies the units in which the metafile is read. By default its value is set to Pixel. It can be also set to Millimeter, Inch or GdiCompatable. This can be useful to preserve the positions and other properties when the drawing is created in millimeter or inch units.
  • Added AutoSize property - defines if size of the root canvas is get from metafiles bounds or its frame. When bounds is used, the root canvas size is just as big as its containing objects.
  • Added GetSize(units) method that can be used to get the size of the read metafile in the specified units.
  • The size of the read metafile is now by default (if MetafileUnits is Pixel) the same as the size shown when metafile is opened by Window.
  • Improved reading metafiles that use MM_LOMETRIC, MM_HIMETRIC, MM_LOENGLISH, MM_HIENGLISH or MM_TWIPS mapping mode.
  • When reading polyline from a metafile and it has only 2 points a Line is used instead of a Polyline.
  • Added UsedMinLineWidthFactor to get the used minimal line width.
  • Improved Ab2d.Utility.ReaderWmf.ResourceDictionaryWriter - now the process of creating ResourceDictionary from metafiles can be better customized by creating a derived class.
  • Removed obsolete Ab2d.WmfViewbox control - the control has been obsolete for a few versions - Ab2d.Controls.WmfViewbox should be used instead. This also removes the need for Designer assemblies to remove the obsolete control from Designer ToolBox.

The Paste2Xaml application that can be used to simply copy objects from drawing application and paste them into XAML was also improved - support for the new features of the Ab2d.ReaderWmd library was added.

 

Some of the changes were also made in Ab2d.ReaderSvg library:

  • Markers (arrows and other line endings) are now correctly show on line and polyline elements (before they worked only on path elements).
  • markerWidth and markerHeight attributes are now correctly handled.
  • Removed obsolete Ab2d.SvgViewbox control - the control has been obsolete for a few versions - Ab2d.Controls.SvgViewbox should be used instead. This also removes the need for Designer assemblies to remove the obsolete control from Designer ToolBox.

 

Now I have to put together the new version of ZoomPanel.

Than a new exciting area awaits - Silverlght 5 with its 3D.

Tags: , , ,

Ab3d.PowerToys | Reader3ds | ReaderSvg | ReaderWmf

New maintenance release for Ab2d.Reader3ds and Ab3d.PowerToys

by abenedik 3. March 2011 21:37

A minor update for Ab2d.Reader3ds and Ab3d.PowerToys libraries is available.

The update fixes licensing code for WPF Browser applications (partially trusted) - before it was not possible to use both Ab3d.Reader3ds and Ab3d.PowerToys the same WPF Browser application.

The update also fixes problems with reading some tga files with Ab3d.Reader3ds. Because some older 3ds files use tga files for textures quite often, the internal tga file reader was added to version 7.0. This version had problems with some tga files. This problems are now fixed.


Some of you have already noticed that the evaluation version has a brand new installer that enables installing any product from only one installer (before each product has to be installed separately). With the new versions the new installers are now available also for commercial products.

Because of the new installers there are also new commercial versions of Ab2d.ReaderSvg and Ab2d.ReaderWmf libraries available to commercial users. Those versions contain just small changes made for the new installation process and do not bring any new functionality.

Tags: , ,

Ab3d.PowerToys | Reader3ds

New versions of 3D libraries bring WPF 3D to a completely new level

by abenedik 16. December 2010 18:19

With the release of Ab3d.Reader3ds v7.0 and Ab3d.PowerToys v2.0 a new milestone in 3D programming was reached.

The first version of WPF brought us simplified programming with 3D. With WPF there is no need any more to deal with C++, DirectX and graphics drivers. Now programmers can use xaml and managed code to define the 3D scene. Besides this WPF can use high end graphic cards when they are available and can fallback to software rendering when the computer does not have an accelerated graphics.

Of course WPF does not provide all the features of DirectX, so it is not capable of running high end 3D games. But my customers have already proven that it is very capable of showing very complex 3D scenes with models with several hundred thousands triangles.

But WPF still lacks many features to make programming with 3D easy.

Now with Ab3d.Reader3ds and Ab3d.PowerToys users have the ultimate framework to work with WPF 3D.

The Ab3d.PowerToys includes advanced cameras, camera controllers (rotate and move the camera with the mouse, etc.), 3D objects (Box, Sphere, Cone, etc.), 3D lines, 3D text and classes to simplify using mouse events on 3D objects.

With Ab3d.Reader3ds and Viewer3ds it is possible to define 3D models in almost any 3D modeling application (3D Studio Max, Maya, AutoCad, etc.), save the objects into 3ds file and use the 3D models in your WPF application.

The libraries gives you a complete solution for:

  • creating monitoring systems with 3D models,
  • displaying 3D simulations and mathematical models,
  • displaying 3D models of your products or prototypes,
  • creating designing and configuration applications in reality-like 3D scenes,
  • creating interesting 3D effects,
  • etc.

 

That was a short overview. Now to the details about the libraries and more information about new features.

Viewer3ds

The new version of Viewer3ds application (3ds to xaml converter) that comes with Ab3d.Reader3ds library brings many new improvements.

The application is now using the Ab3d.PowerToys library. Therefore it was really easy to add camera rotation and movement. Among other changes I would also like to mention the new possibility to get detailed information about selected objects (sizes, materials, detailed mesh information, etc.).

 

The Ab3d.Reader3ds library also got many improvements.

The biggest enhancement is great performance improvement - because of optimized algorithm and multi-threaded processing some 3ds files are read 80% faster. But reading some very large 3ds files can still take a few seconds. To improve user experiance it is now possible to get progress reports while reading the file. The samples that came with the library demonstrate how to show progress window on another thread or read the 3ds file on another thread and show the progress on the main thread.

Let me also mention some other important changes:

  • Improved handling of texture files with simplified notifications about missing texture files.
  • Added GetXaml method to Reader3ds class to get formatted xaml text of the read 3ds file.
  • Improved reading FiledOfView and SpecularMaterials.
  • Improved support for running in partially trusted environment.
  • Added Lights collection.

Complete list of changes can be seen here.

 

Viewer3ds

I am really proud of the features and capabilities the Ab3d.PowerToys library. They really bring WPF 3D to a completely new level.

The library makes Visual Studio a simple 3D modeling application as all the 3D objects and cameras that are defined in xaml are immediately seen in designer window. This way it is very easy to arrange the objects, set camera or otherwise define the scene.

Already the previous version of the library had advanced cameras (SceneCamera, FirstPersonCamera, ThirdPersonCamera) that enable setting the camera with simply setting heading, attitude and bank angles and defining some other properties like distance. The cameras can be simply rotated with the mouse or camera control panel. The new version goes further with enabling moving the camera. Now any camera can be rotated and moved around. And it is possible to assign rotation and movement of the camera to any mouse button and to any keyboard modifiers. For example the following two lines of xaml add a SceneCamera to the scene and enable rotationg the camera with right mouse button and moving the camera with right mouse button and alt key pressed:

<cameras:SceneCamera Heading="30" Attitude="-20" Distance="200"/>
<ab3dControls:MouseCameraController RotateCameraConditions="RightMouseButtonPressed"
                                    MoveCameraConditions="RightMouseButtonPressed, AltKey"/>

The previous version of Ab3d.PowerToys already included many basic 3D objects (Box, Sphere, Cone, etc), 3D Lines and simplified mouse event handling on 3D objects.

Besides improved cameras the following are the main improvements of the new version:

  • Added support for 3D text.
  • Improved PolyLines - they are now correctly connected to each other.
  • Added MultiMaterialBox where each side of the box can have its own material.
  • Added CreateFrom method to all Ab3d.Cameras - it can be used to create any Ab3d.Camera from existing WPF's Camera (or camera read from 3ds file with Ab3d.Reader3ds).
  • Added CameraAxisPanel - a predefined panel that shows the axis orientation for the target camera.
  • Added RectangleVisual3D, WireBoxVisual3, WireCrossVisual3D, VerticalPlaneVisual3D and LineArcVisual3D.
  • Added IsVisible property to all 3D models derived from Visual3D.
  • Added CreateWireframe method that takes Model3D to create wireframe from Model3DGroup or GeometryModel3D.
  • Fixed for using in partially trusted environment - before creating custom cursor was not allowed - now a Hand cursor is used instead.
  • BREAKING CHANGE: Fixed Bank - now the positive bank values rotate the camera in the clockwise direction (before the direction was counter-clockwise). For example bank angle 30 means that the Camera is rotated as a head would be bended to the right.

The complete list of changes is really long - it can be seen on Abd3.PowerToys web page.

 

A quick preview of cameras and 3D objects can be seen from two cheat sheets (prepared with WPF; full source code is included with the samples that come with the library):
Cameras cheat sheet
Cameras cheat sheet


Objects cheat sheet
3D Objects cheat sheet

 

The following are a few screenshots (click on xaml link to see the xaml source code):

[xaml] [xaml] [xaml]
 
 
[xaml] [xaml]  

 

To see more screenshots and details about the library see Abd3.PowerToys web page.

 

Ab3d.Reader3ds and Ab3d.PowerToys are separate products, but when the Ab3d.Reader3ds pro library license is purchased, the price for Ab3d.PowerToys library is ONLY 1 USD.

 

I am already planning to add a few new exciting features to the library. If you have any recommendation and other comments you are most welcome to post them to the library’s forum.

 

As usual the new version can be downloaded from User Account page (for commercial users) or from my Downloads page (for evaluation version).

 

PS: For the customers of Ab3d.Reader3ds with expired updates subscription I am preparing a very special offer to renew the subscription – detailed information will be sent to your email in the following days.

Tags: , , , ,

Ab3d.PowerToys | Reader3ds

Business transfered to a new company - AB4D d.o.o.

by abenedik 6. December 2010 21:18

Today is a great day!

After almost a month of dealing with bureaucracy I am happy to announce that today I have made the final step in establishing a new company AB4D d.o.o.

Until today all the products from www.ab4d.com were developed and sold in behalf of Andrej Benedik s.p. – a legal form of a sole proprietor.

Because the business has grown, the limitations of sole proprietor legal form have become too tight. So it was time for a step forward – to establish a real company in a form of limited liability company (d.o.o.).

After registering the company, opening a new bank account, registering for Euro VAT ID, opening new accounts on PayPal and Gate2Shop, adjusting the invoices and other content on web site, today, as the final step, the production web site (www.ab4d.com) was updated. Today the company had made its first breath of air.

Thank you for all your great feedback and support. I will do my best that under the new company your satisfaction will be even bigger.

To begin with I am planning to release a new version of Reader3ds and Ab3d.PowerToys in the next week. The new libraries will make programming with 3D so easy that even your grandma could do it (without even knowing that there are heavy C++ and DirectX books).

 

PS:

Where did the name of the company came from?

The users of the libraries will quicky guess that it came from the names of the namespaces used in my libraries (Ab2d and Ab3d). But wait - in this case the name should be AB5D. Ah, screw math - AB4D sounds better :)

Tags:

Web Page

Improved verson of Ab2d.ReaderWmf is available

by abenedik 19. October 2010 14:03

The Ab2d.ReaderWmf library has recieved a minor updated.

This update improves and fixes the following issues:

  • Fixed reading some embedded images (before sometimes FileFormatException was thrown).
  • Improved positioning text and handling rotated texts.
  • Fixed reading arc and pie segments for some cases.
  • Improved GetXaml method - now the images are written to xaml without need to specify ResolveImagePath delegate. The uri format can be specified with the new DefaultImageUriFormatString property in XamlWritterSettings.
  • Added ImageFileExtention string to EmbeddedImageData.
  • Improved setting minimal line thickness. In metafile a line thickness can be specified to 1 pixel regardless of the zoom level - this is not possible in WPF and Silverlight. The algorithm that sets the line thickness has been improved to prevent getting too thick lines.

 

As usual the new version can be downloaded from User Account page (for commercial users) or from my Downloads page (for evaluation version).

Tags: , ,

ReaderWmf

New version of Ab2d.ReaderSvg and ViewerSvg

by abenedik 20. August 2010 17:55

The best svg reader for WPF and svg to xaml converter for WPF and Silverlight is now even better.

This release focuses mostly on making work with Ab2d.ReaderSvg easier. Now it is possible to get progress report when reading svg files (there are also two interesting samples about this). It is now easier to use GetXaml method when the read svg file has embedded images. Also the ResourceDictionaryWriter class (helper class to create ResourceDictionaries from svg files) is now greatly improved. With new protected fields and protected virtual methods it is now very customizable.

The reading engine also has some improvements. It fixes some of the special issues that were reported by error reporting in ViewerSvg. The number or error reports is now very low and this tells that the reading engine is already very good and can handle really most of svg files.

The problems with showing the exported xaml in Visual Studio 2010 designer for Silverlight are now gone. With the new version the GetXaml method sets Width and Height to Path element when it is called to create xaml for Silverlight. This is a workaround for a bug in Visual Studio - please vote for the bug on Microsoft Connect so it will be fixed as soon as possible.

The samples have also been updated. There are now a few more samples and they are now available for both Visual Studio 2008 and 2010.

The following is a list of all changes in Ab2d.ReaderSvg:

  • Added ProgressChanged event to ReaderSvg to get report progress when reading file.
  • Improved GetXaml method for Silverlight: Added workaround for displaying Paths in Silverlight in Visual Studio 2010 designer - set Width and Height to Path element.
  • Improved GetXaml method - now the images are written to xaml without need to specify ResolveImagePath delegate. The uri format can be specified with the new DefaultImageUriFormatString property in XamlWritterSettings.
  • Improved reading linked images (not embedded into svg file). Before an exception was thrown when the image file could not be located - now the image object is created but its Source is not set.
  • Fixed reading some svg files with embedded image that reported "Invalid length for a Base-64 char array." error (used custom base64 reader instead of .Net method to read the string).
  • Fixed problems with reading svg files from Microsoft Visio that have more than one layer with the same name defined.
  • Improved ResourceDictionaryWriter class to make it much more customizable. The AddFile and AddStream methods now work correctly. The usedSvgReader, geometrySettings and xamlWritterSettings fields are now protected so they can be changed in derived class. Also the methods CreateReaderSvg, CreateXamlWriterSettings, ReadSvgFile, ReadSvgStream, GetXaml, GetRootResourceKey and ResolveResourceKeyCallback are now protected and virtual so they can be overriden in derived class.
  • Added AddHiddenElements property that specifies if hidden elements are read. If the value of AddHiddenElements is true, than hidden elements are read and have their Visibility property set to Hidden or Collapsed (depends on using display or visibility attribute in svg file).

 

 

As always the ViewerSvg application has also been improved.

As with Paste2Xaml the ViewerSvg can now also change the size of read elements to any custom size. This is not done with only adding a ScaleTransform to the root element (as in previous versions) but now the positions, sizes and other values are changed to fit into the new size.

The improvements in Ab2d.ReaderSvg are also reflected in ViewerSvg. There is now an option to read or skip reading hidden elements. The export dialog also has some new settings - see the following is a screenshot:

ViewerSvg export dialog

 

As usual the new version can be downloaded from User Account page (for commercial users) or from my Downloads page (for evaluation version).

Tags: , , ,

ReaderSvg

Giant leap forward in reading metafiles for WPF and Silverlight

by abenedik 30. July 2010 23:22

Giant leap forward?

Check out the size of this blog post and you will see that I could not describe the new release of Ab2d.ReaderWmf and Paste2Xaml with any other words.

 

Both Ab2d.ReaderWmf and Paste2Xaml have been greatly improved. Ab2d.ReaderWmf is a library to import Windows metafiles (wmf) and Enhanced Metafiles (emf) into WPF application. Paste2Xaml is an application that is using Ab2d.ReaderWmf libraray and can be used to convert metafiles from files or clipboard into xaml for WPF and Silverlight.

First let me describe the new features of Ab2d.ReaderWmf library. Then I will describe the improvements of Paste2Xaml than besides new things from Ab2d.ReaderWmf also has some other great new features.


New features of Ab2d.ReaderWmf 5.0 at a glance
(major improvements are described below in more details):

Major improvements:

  • Improved reading detailed images from EMF+ records. Reading is now much faster. With added EmbeddedImagesData collection it is possible to get original image byte arrays with image format (png, jpg, etc.). It is also possible to skip reading EMF+ records with new ReadEmfPlusRecords.
  • Optimizing gradients defined in metafiles. Creating one Rectangle or Polygon with real LinearGradientBrush instead of numbers of Polygon that are defined in metafile. Optimizing gradients can be controlled with CombineGradientPolygons property.
  • Reading character spacing information that can be used to position each character in text. This functionality can be enabled or disabled by ProcessCharacterSpacing property.
  • Controlling the size of read metafile with CustomContentWidth, CustomContentHeight properties.



Improvements for Silverlight (when using with Paste2Xaml to create xaml for Silverlight; Ab2d.ReaderWmf  cannot be used in Silverlight projects):

  • Improved GetXaml method for Silverlight: added workaround for displaying Paths in Silverlight in Visual Studio 2010 designer - set Width and Height to Path element.
  • In Silverlight projects it is not possible to define PathGeometry’s data as string that would work in Silverlight and in Visual Studio 2010 designer. Therefore PathGeometry is now written as collection of PathFigures instead of data string.
  • Each PathGeometry is analyzed and if possible it is converted into RectangleGeometry.



Other fixes and improvements:

  • Fixed problems when running on 64-bit OS.
  • Fixed reading images that have width or height value defined as negative numbers - now the images are correctly mirrored.
  • Added IsClipboardMetafileAvailable, GetFromClipboard, GetGeometryFromClipboard methods to simplify getting metafiles from clipboard.
  • Added RemoveEmptyTextBlocks property - useful when copying from office documents to skip lots of empty TextBlock elements.
  • Added ProgressChanged event that can be used to get progress notifications while reading metafile. Please note that in order to show changes with the progress bar, it should be shown on another thread and not on the thread where the ReaderWmf is working. I am going to write a blog post about it based on the solution used in Paste2Xaml.
  • Improved ResourceDictionaryWriter class.  The AddFile and AddStream methods now work correctly. It is also possible to overwrite some of the methods to set some additional settings - for example number of decimals or using SilverlightXamlWriterSettings to create ResourceDictionary for Silverlight.
  • Some other improvements and fixes to improve reading metafiles that were sent as error report or feedback.


Now let me describe each of the major improvements in more detail.

Reading detailed images from EMF+ records:

Because normal metafile records do not enable storing images with transparencies they usually contain only lower quality images. The higher quality images are usually stored in EMF+ part of the metafiles.

The previous version of Ab2d.ReaderWmf library introduced possibility to read images from EMF+ records. But processing of those images could sometimes be very slow and could produce very big images (for example 4000 x 3000).

After a lot of effort I am now proud to say that the new version can much more accurately and much faster read the details images. Actually it is possible to get the original bytes that are used to define the image and the image file format. For example if a PowerPoint slide is created with a jpg image, it is now possible to get the same jpg image from Ab2d.ReaderWmf. Those data can be get from EmbeddedImagesData collection.

 

Optimizing gradients

Because metafiles do not provide a way to define gradients, the linear gradients are usually defined by series of Polygons or Rectangles where each of them has slightly different color. So instead of one Rectangle with LinearGradienBrush we got many Polygons.

And the number of polygons was not the biggest problem. Much bigger problem was when those polygons were rendered by WPF or Silverlight. There were many lines shown between polygons – as there would be an empty space between them. This was caused by the way WPF and Silverlight handle antialiasing. I have reported this issue to Microsoft Connect but it does not look that it will be fixed - see here.

To overcome those problems the new version of Ab2d.ReaderWmf analyses the read polygons and rectagles and if possible convert them into single Rectangle or Polygon with real LinearGradienBrush.

So instead of tens of polygons:

<Polygon Points="496,1494 496,1506 1678,1506 1678,1494" Fill="#FF000082"/>
<Polygon Points="496,1506 496,1517 1678,1517 1678,1506" Fill="#FF020082"/>
<Polygon Points="496,1517 496,1533 1678,1533 1678,1517" Fill="#FF040083"/>
<Polygon Points="496,1533 496,1544 1678,1544 1678,1533" Fill="#FF060083"/>
<Polygon Points="496,1544 496,1560 1678,1560 1678,1544" Fill="#FF080083"/>
<Polygon Points="496,1560 496,1571 1678,1571 1678,1560" Fill="#FF0A0083"/>
<Polygon Points="496,1571 496,1587 1678,1587 1678,1571" Fill="#FF0C0084"/>
<Polygon Points="496,1587 496,1599 1678,1599 1678,1587" Fill="#FF0E0084"/>
...

We get:

<Rectangle Width="1182" Height="2316" Canvas.Left="496" Canvas.Top="1494">
    <Rectangle.Fill>
        <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
            <GradientStop Color="#FF000082" Offset="0"/>
            <GradientStop Color="#FF68008E" Offset="0.3"/>
            <GradientStop Color="#FFB80067" Offset="0.6"/>
            <GradientStop Color="#FFFF0200" Offset="0.9"/>
            <GradientStop Color="#FFFF8200" Offset="1"/>
        </LinearGradientBrush>
    </Rectangle.Fill>
</Rectangle>

The rendered results are also much better:
Optimize gradients in ReaderWmf


Processing character spacing information

Texts in metafiles can have additional character spacing information that for each character in text define its offset. This can be used to create wider or more condensed text.

In WPF or Silverlight there is no such possibility except defining each character with its own TextBlock.

To create similar text sizes and also prevent dividing text, the new version of ReaderWmf can apply ScaleTransform to TextBlocks that need to display wider or more condensed text.

This functionality can be enabled or disabled with ProcessCharacterSpacing property.


Custom content Width and Height

By default the size of the read content is defined in the metafile. In this case the size is specified in GDI device units. This means that the size of read content is usually a few thousands x a few thousands (for example for A4 page copied from Microsoft Word the metafile size is 4253 x 4871).

Sometimes it can be unpractical to deal with sizes in thousands and font sizes in hundreds – for example when you need an 20 x 20 image.

In this case CustomContentWidth or CustomContentHeight can be set to specify how big the content size will be regardless of the size defined in metafile. In case only one of those properties is set, the aspect ratio of the read objects will be preserved.

To create a desired size, the Ab2d.ReaderWmf does not only add a RenderTransform to the root object but it actually changes all the positions, sizes and other data.



New features of Paste2Xaml application

Paste2Xaml main screen

The screenshot above shows the main user interface of the new Paste2Xaml application.

In the bottom right there are four new CheckBoxes. The first three are used to control some of the new features of Ab2d.ReaderWmf library. The last one is shown only when custom content size is remembered from previously read metafiles –details about Export dialog for more information about this.

Other improvements on the main screen are related to object selection and its manipulation.

On the upper left corner there is toolbox. The first button is used to toggle between selection and zoom mode. When it is unchecked, the zoom mode is controlled by other toolbox buttons. Note that Paste2Xaml is using ZoomPanel control that can be also bought from wpf-graphics.com. This means that you can have the same zooming functionality in your own WPF application (prices start from only $69 for single developer license).

When in selection mode it is possible to select individual objects with clicking with the mouse over the shown elements. It is also possible to hold the left mouse button down and move the mouse over objects – this is useful to preview how the objects are defined.

When an object is selected the three new buttons above objects TreeView become enabled.

The first one can be used to rename the selected object.

When the next button is clicked a Context Menu is opened. From there it is possible to convert the selected TextBlock or Rectangle into TextBox or ComboxBox.

This can be used to design forms form WPF or Silverlight applications in Microsoft Word, Excel or some other drawing application. Then you can select all objects in the form and copy and paste them into Paste2Xaml. There you can simply convert some predefined text elements or rectangles into TextBoxes or ComboBoxes and export the form into xaml. It is also recommended that you rename some elements and change the size of the form in the Export dialog (more about this later).

The last button above the TreeView can be used to delete the selected object.

A feature that is not so important but is very nice is a progress bar that is shown when bigger metafiles are loaded. It is using a new ProgressChanged event on ReaderWmf. I am going to write a blog post about it based on the solution used in Paste2Xaml.


Paste2Xaml Export dialog screen

The Export dialog also has some new parts.

There is a new Images tab where it is possible to preview the embedded images.

In the options part there are now new options to control the number of displayed decimals. In previous version the xaml was created with all numbers (except some transformations) displayed as integer number. This was enough because all the numbers in metafiles are also defined as integer numbers. But with the new version it is possible to change the size of the read objects – there integer numbers would not be enough. Note the xaml writer used by ReaderWmf removes the ending 0 decimals – for example “12.340000” is written as “12.34”.

The most important new feature of Paste2Xaml can be controlled by the Change Size options. There it is possible to enter new width or height and change the size of the read elements. As with CustomContentWidth and CustomContentHeight properties in Ab2d.ReaderWmf the change affects all the positions, sizes and other data of read objects. This is very useful to bring the size of the read elements into common sizes for WPF and Silverlight applications.

To change the size first select the “Width” or “Height” radio button, than enter the desired value and click “Change size”.

If you would like to use the same custom size with other metafile also, check the “Remember custom size for other metafiles” CheckBox. This will immediately save the setting (settings will be preserved when the Paste2Xaml is closed). When this checkbox is checked and the Export dialog will be closed there will be a new “Use custom width / height” CheckBox on the main screen. It is used to see what custom size will be used to read the metafile and also to remove the saved custom size settings.


That is about it.

I hope you will find the new features useful.


As usual the new version can be downloaded from User Account page (for commercial users) or from my Downloads page (for evaluation version).

Tags: , ,

ReaderWmf