FontDialog

GeneDoc

Member
Joined
Sep 6, 2005
Messages
9
Programming Experience
3-5
Ok, so the FontDialog isn't supported in the compact framework. I'm through swearing about it. Now what? I've tried reading online and a couple books and don't understand the alternatives. Does everyone make their own custom control to list a device's font? Seems cumbersome. It's very important for people using my main program to be able to load new fonts on their device and then have ready access to the fonts.

Any thoughts? Thanks. I'm not necessarily looking for specific code, but at least ideas as to how others solve this problem.

Mike
 
Ok, lest anyone think I didn't do *any* legwork, I'll post a bit of rambling...

On Googling various strings (e.g. "compact framework fontdialog"), it becomes readily clear that FontDialog isn't supported. What is surprising is that this doesn't seem to bother many people. One MVP user response was that this omission wasn't surprising, given how few fonts there are on the typical Pocket PC. Unfortunetly, I need my current app to work with *any* language and customers keep asking for support of their language. So, I just wish a FontDialog had been included.

<crying done>

So, hunting around has shown that in three years or so that the compact framework has been out there, no one seems to have publicly posted a workaround. This has me worried that there is a real replacement and that's why no one needed to make a workaround. Here are my current conclusions (correct them if I'm wrong please):
1. FontDialog is not supported in the Compact Framework (duh!)
2. There is no widely-available workaround
3. There is no inherent control that was implemented to replace the FontDialog control

So, guess I'll need to learn how to write a control. In case I really am not the only one that needs to do this, here are some posts that seem to help:
1. The www.gotdotnet.com board has a post that helps ( http://www.gotdotnet.com/community/messageboard/Thread.aspx?id=242812 ).
2. Paul Yao's book, chapter 16, also has some stuff that helps ( http://www.paulyao.com/cfbook/ ).
3. Another suggestion addresses using callbacks ( http://www.developmentnow.com/g/18_2003_8_0_0_92200/FontDialog.htm ).

If I get anywhere, I'll try to post it for others to use.
Mike
 
the Windows.Forms.FontDialog is in the compact framework

i just made a quick application (containing a label a button) and used the fontdialog to change the label's font then i ran it on my laptop that only has the compact framework 1.1 on it and it works just fine

just thought i'd let ya know
 
VB.NET:
Dim fd As New Windows.Forms.FontDialog
fd.Font = control.Font
If fd.ShowDialog <> DialogResult.Cancel Then
  control.Font = fd.Font
End If

for example, unless i'm still not interpreting the question/problem correctly
but i do know the dialog is in the compact framework so it can be called/used on pda's, phones, other portable devices, etc...
 
First, thanks for answering. I appreciate it.

Second, I'm confused becuase you're saying it's there but the docs say it isn't. If you're right, I'll give you a big hug. Ok, maybe just a big thanks.

Third, I'm a newbie to .NET (duh) and am having a hard time defining the namespace reference for your code. I'm using the VS 2005 .NET environment with Compact Framework v2. I used "Imports System.Windows.Forms", but still get a 'type not defined' error. I did change the 'control' in your code to the appropriate control name in a form, but I just don't know what to do to define the namespace you provided. I tried the same thing in my VS 2003 .NET with CF v1.1 and still have a problem defining the namespace.

Thanks,
Mike
 
i'm using VS2003 and all i do is call the object "System.Windows.Forms.FontDialog" and that's it, the complete namespace right to the object, i've never used 2005 because i'm waiting for the final release & cost to come down
 
From the VS.NET 2003 help topic for the FontDialog:
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
From the MSDN2 help topic for the FontDialog:
Platforms
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
It looks like it wasn't available in CF 1.1 but it is in 2.0.
 
jmcilhinney said:
It looks like it wasn't available in CF 1.1 but it is in 2.0.
Thanks for looking at this topic. Unfortunately, I think the documentation isn't quite that clear.

In the VS 2005 documentation with CF 2.0, you see the following:

Target Platforms:
Windows 98, Windows 98 Second Edition, Windows Millennium Edition, Windows 2000, Windows 2000 Server, Windows 2000 Advanced Server, Windows XP Home Edition, Windows XP Professional, Windows Server 2003, Windows "Longhorn", Windows Mobile 2003 for Pocket PC, Windows CE, Windows Mobile 2003 for Smartphone

Version Information:
.NET Framework -- Supported in: 2.0, 1.1, 1.0

So, if the doc's say the target platforms include smart devices, then why doesn't it list the .NET Compact Framework, such as what is shown for the SaveFileDialog:

Version Information
.NET Framework
Supported in: 2.0, 1.1, 1.0
.NET Compact Framework
Supported in: 2.0, 1.0

So, I am still quite confused about what is available. I think there's real confusion about what is supported in VB .NET CF based on the documentation described to date. That's too bad, but I guess I'll have to just live with it. Just for kicks 'n grins, I changed the target platform to the Windows Mobile device and not Pocket PC 2003 and opened a new project, but there's still no FileDialog control in the Toolbox. If it's not here in the VS 2005 with CF 2.0 in beta 2 form, I'd be amazed if it'll be there when the version goes gold in a couple months.

Mike
 
Hmmm... that is kind of ambiguos isn't it. It does say that the FontDialog targets mobile platforms but it doesn't say it's part of the CF. That doesn't really make sense to me. I'm not a mobile developer myself so I'm afraid I can't be of any more use to you. :(
 
Thanks for trying. I've briefly vented to one contact at Microsoft specifically about this issue, but I didn't try to impose upon him for a solution. I have to say the migration to .NET CF isn't going nearly as smoothly as I had hoped. :mad: :(

I wonder if there are any mobile device programmers lurking around here or if this is primarily a desktop programmer's haven.
 
Yup. That's a great site. I have every pair of fingers and toes on my body crossed, hoping the opennetcf group would have hit this issue with a solution, but didn't find one there. Boy, was I bummed when I didn't find the answer there. Unfortunately, their forum search function isn't working, so the answer may actually be there, but I just can't find it.
 
I suggest you go to www.codeproject.com and do a search for "fonts". There is nothing specific to what you want I'm afraid, but there are several examples of using a ComboBox to display a list of fonts. You may well be able to apply some of the same principles to your own problem.
 
Back
Top