I had tried your code and for some reason got this error
An unhandled exeption of type ystem.NullReferenceExceptionoccurred in
Additional information: Object reference not set to an instance of an object.
I got the error on the Dim data line (see below) but I think the problem lay
with the previous line not picking up the Radio font properly. I think this
because I watched debug autos and it looked like the
mbedTTF.vb.Radio___.TTFdid not work since the fontStream was othing
after it left that line.
Yes. I added the reference for Radio___.TTF just like you show in your
example. Am I right in thinking that the culprit is the fontStream not being
loaded properly since if it value is othing?
'load the resource
Dim fontStream As Stream =
'create an unsafe memory block for the data
Dim data As System.IntPtr = Marshal.AllocCoTaskMem(fontStream.Length)
"Bob Powell [MVP]" wrote>
> In addition to Ken's suggestion you might want to read the article >n
> embedding true type fonts in Windows Forms Tips and Tric>s.
> Bob Powell [M>P]
> Visual C#, System.Draw>ng
> Ramuseco Limited .NET consult>ng
> Find great Windows Forms articles in Windows Forms Tips and Tri>ks
> Answer those GDI+ questions with the GDI+ >AQ
> All new articles provide code in C# and VB.N>T.
> Subscribe to the RSS feeds provided and never miss a new artic>e.
> "BobAchg<ll" < XXXX@XXXXX.COM >.com> wrote in messa>e
> > Has anyone had success with writing text using a private font that was >o>
> > already installed to the syst>m>
> > When I try the example code in NET Framework Developer's Guide cal>e>
> > "Creating a Private Font Collecti>n>
> > ... I only see a default font written to the form NOT the private fo>t>
> > t>a>
> > was loaded. Ofcourse I see the right font written if the font is alrea>y>
> > >n>
> > that is installed in the system. But if the private font that I load w>t>
> > the AddFontFile method is one that has not been already installed in >h>
> > Windows system then the example text is written in a default fo>t>
> > I am guessing this is my problem and not a bug in the Visual Basic .>e>
> > class. Can you set me straight as to what I might be doing wro>g>
> > Than>s>
> > >o>