Access to FontStyle in VB.Net 2.0beta


  • Hi all,

    I am writing an application for storing data. This data can be printed in a specific format right out of the application. So far there are no problems. For the printing operation I use specific fonts, that are owned by my company. As soon as I try to use one of these fonts in the printing method, I get an error, that the font does not support FontStyle x, although I can find the FontStyles in MS Word. The font I used supports generally four different FontStyles. All of them can be used in MS Word and any other application. In .Net I can only use the second FontStyle that is addressable via FontStyle.Italic.

    Does anyone know how to address the font and the other FontStyles?
    The other FontStyles obviously exist, but I cannot address them in .Net.

    All help is kindly appreciated.


    I was able to get a more specific error on this case. I used a FontDialog to choose the error throwing font. As soon as I close the dialog, an exception is thrown:
    System.ArgumentException: Parameter is not valid.
    at System.Drawing.Font.GetHeight(Graphics graphics)
       at System.Drawing.Font.get_SizeInPoints()
       at System.Windows.Forms.ControlPaint.FontInPoints(Font font)
       at System.Windows.Forms.FontDialog.UpdateFont(LOGFONT lf)
       at System.Windows.Forms.FontDialog.RunDialog(IntPtr hWndOwner)
       at System.Windows.Forms.CommonDialog.ShowDialog(IWin32Window owner)
       at System.Windows.Forms.CommonDialog.ShowDialog()

    I just choose a font with a specific style in a general font dialog and get this exception. Has anyone any ideas regarding this?

    Wednesday, January 25, 2006 4:16 PM