473,322 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

XAML: FontSize="12pt"; C#: ?

I want to take the FontSize from a System.drawing.Font type and turn
that into a System.Windows.Controls FontSize. (Actually, I'd like to
take the whole font over, but I didn't see any standard converter.)
The former is a float and the latter a double. In XAML, though, you
can specify a string to handle the conversion. I understand I can do
this: NewFontSize = MainOldFont.Size * 96/72; however, isn't that 96
dependent upon a user setting? Do I have access to that setting
somehow? Thanks.

Feb 16 '07 #1
1 5784


"not_a_commie" <no********@gmail.comwrote in message
news:11**********************@s48g2000cws.googlegr oups.com...
>I want to take the FontSize from a System.drawing.Font type and turn
that into a System.Windows.Controls FontSize. (Actually, I'd like to
take the whole font over, but I didn't see any standard converter.)
The former is a float and the latter a double. In XAML, though, you
can specify a string to handle the conversion. I understand I can do
this: NewFontSize = MainOldFont.Size * 96/72; however, isn't that 96
dependent upon a user setting? Do I have access to that setting
somehow? Thanks.
No.

See:

About Resolution and Device-Independent Graphics
There are two system factors that determine the size of text and graphics on
your screen: resolution and DPI. Resolution describes the number of pixels
that appear on the screen. As the resolution gets higher, pixels get
smaller, causing graphics and text to appear smaller. A graphic displayed on
a monitor set to 1024 x 768 will appear much smaller when the resolution is
changed to 1600 x 1200.

The other system setting, DPI, describes the size of a screen inch in
pixels. Most Windows systems have a DPI of 96, which means a screen inch is
96 pixels. Increasing the DPI setting makes the screen inch larger;
decreasing the DPI makes the screen inch smaller. This means that a screen
inch isn't the same size as a real-world inch; on most systems, it's
probably not. As you increase the DPI, DPI-aware graphics and text become
larger because you've increased the size of the screen inch. Increasing the
DPI can make text easier to read, especially at high resolutions.

Not all applications are DPI-aware: some use hardware pixels as the primary
unit of measurement; changing the system DPI has no effect on these
applications. Many other applications use DPI-aware units to describe font
sizes, but use pixels to describe everything else. Making the DPI too small
or too large can cause layout problems for these applications, because the
applications' text scales with the system's DPI setting, but the
applications' UI does not. This problem has been eliminated for applications
developed using WPF.

WPF supports automatic scaling by using the device independent pixel as its
primary unit of measurement, instead of hardware pixels; graphics and text
scale properly without any extra work from the application developer. The
following illustration shows an example of how WPF text and graphics are
appear at different DPI settings.

http://msdn2.microsoft.com/en-us/library/ms748373.aspx

Feb 16 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Thilaka | last post by:
Hi guys, Recently i read some articles on Longhorn & XAML. & From what i learnt the future for developing UIs lies in XAML. Does this mean that I've got to learn XAML as developing UIs for web...
13
by: Jeff | last post by:
How important is XAML? (or how important is it expected to become during the next 5 years?) Looking for informed opinions. Thanks!
7
by: GVN | last post by:
Hi All, I would like to write a .NET application which uses XAML. The following is my system's specification: Operating System : Windows XP ..NET Framework : 1.1
3
by: Brent | last post by:
OK i downloaded the new/addon framework 3 and downloaded the VS 2005 addon. I started with XAML. So far im like mehhhhhhhh. Anyone else have the same opinion? When i first heard about xaml i got...
2
by: azerty | last post by:
Hello I try to use xaml serializer framework to save in .xaml file my own hierarchical graph of object. The first step is done : I create my own file with something like this : <Root
1
by: =?Utf-8?B?b3JpYXpvd2Fu?= | last post by:
Hi, Im just getting into the beutifull world of .NET framework 3.0. But im a little confused about the sample codes i have seen so far. Im particularly interested in document layout and auto...
6
by: moondaddy | last post by:
will CodeDom create XAML windows or just regular windows forms? If so, how to I tell it to create a xaml window instead of a windows form? thanks -- moondaddy@noemail.noemail
0
by: =?Utf-8?B?WmlnZ3lTaG9ydA==?= | last post by:
I have a sample XAML file: <StackPanel xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> <Button Name="button2" Height="23" Width="300" Margin="31,37,0,0" Click="doit">Hello...
6
by: star-italia | last post by:
Hi, Is it possible to include a XAML file into another XAML file? For example If i have - Window1.xaml - Window2.xaml and both have a treeview with a custom Style, can i describe the style...
4
by: moondaddy | last post by:
I have a user control located in the following path: projectFolder/PropertyControls/myControl.xaml and in myControl.xaml I have a reference to a resource dictionary like this: ...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.