Gergely Kovásznai, Csaba Biró
Eszterházy Károly College
Windows Presentation Foundation (WPF) is regarded as the successor of Windows Forms in desktop application development. Although WPF can be considered different than traditional Windows Forms, it is based on a number of principles which form the basis of existing desktop frameworks. The largest and the most important difference is that the code responsible for the appearance of application distinct from the code describes the functionality of the application. It is only one of the several technological innovation.
Breaking the WinForm traditions, WPF based on graphics technology now is DirectX instead of GDI/GDI+. DirectX is due to direct access to any type of user interface can be created. Complex three-dimensional graphics can be planned, but you can use the rich graphical effects for business applications (anti-aliasing, transparency, animation). Due to the hardware acceleration, the DirectX relieves the processor as possible during the graphics rendering burdens the video card (GPU) instead. They become much faster the intensive graphics tasks such as playing animations.
In the traditional Windows Forms applications the cancellation/revolution tied the developers who usually designed it for a standard definition monitor (e.g: 1024 x 768). One of the biggest problem in the case of traditional Windows applications, that the user interface was not scalable. The previous problem can be eliminated due to the WPF, because the graphic elements are not rasterized, but vector-based. Consequently, each items can be arbitrarily resized. Another great advantage is that the vector-based images occupy less space than the raster elements. However, it shouldbe noted that the WPF will continue to support raster graphics.
The WPF generated for the dimension-treatment of the window and all the elements called device independent units (device-independent unit – DIU), which is one-ninety-sixth part of an inch. In the case of a standard Windows DPI setting (96 dpi) corresponds exactly to a phisically real pixel.
A 19-inch LCD display for a maximum resolution of 1600 x 1200, the real pixel density can be calculated as follows:
It follows that the actual size of this display, a 96-pixel wide object is less than 1 inch. While a lower resolution (85 dpi) in the case of 15-inch LCD display, the preceding object is slightly larger than 1 inch.
The WPF introduced the following method of calculation to overcome this problem. Let’s consider an already said to be ordinary resolution (120 dpi). In this case, 120 pixels are necessary to fill 1 inch. In WPF, the logical units can be transformed into pixels with the following calculation model:
So a 120 dpi resolution corresponds to a DIU 1.25 pixel. Thus, the previously examined 96 DIU wide button, the physical size: 120 pixels (96x 1.25=120).
Of course, other units may be used, such as „in” (inch), „pt” (pixels), „cm” (centimetre). The default unit is „px” (pixel)
II.1 Example Units
<Button Width="200" Height="30">
<Label Content="Hello World!" FontSize="12"/>
<Button Width="200pt" Height="30pt">
<Label Content="Hello World!" FontSize="12pt"/>