none
LogFont in VC++ 2008? RRS feed

  • Question

  • According to the documentation, I need a reference to Microsoft::WindowsCE::Forms to declare a LogFont, but I can't seem to find it, either via add reference or autocompletion of a namespace statement. Am I missing something really basic, or has a library not been installed? I'm using Visual Studio 2008, 90 day trial version.
    Friday, September 25, 2009 3:19 PM

Answers

  • You won't see every assembly in the Add Reference dialog - the assemblies can vary depending on the project type. You'll need something like a smart device project to see that assembly in the Add Reference dialog. It's typically located under "Program Files\Microsoft.NET\SDK\CompactFramework\v3.5\WindowsCE\Microsoft.Windowsce.Forms.dll".
    • Marked as answer by eryang Friday, October 9, 2009 3:53 AM
    Friday, September 25, 2009 4:44 PM
  • Don't add references to Microsoft.WindowsCE, they are not going to be available on the target machine.  If you want a Windows LOGFONT, just declare it yourself:

    using System.Runtime.InteropServices;
    ...
        [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
        public class LOGFONT {
            public int lfHeight;
            public int lfWidth;
            public int lfEscapement;
            public int lfOrientation;
            public int lfWeight;
            public byte lfItalic;
            public byte lfUnderline;
            public byte lfStrikeOut;
            public byte lfCharSet;
            public byte lfOutPrecision;
            public byte lfClipPrecision;
            public byte lfQuality;
            public byte lfPitchAndFamily;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x20)]
            public string lfFaceName;
        }


    Hans Passant.
    Friday, September 25, 2009 7:12 PM
    Moderator

All replies

  • You won't see every assembly in the Add Reference dialog - the assemblies can vary depending on the project type. You'll need something like a smart device project to see that assembly in the Add Reference dialog. It's typically located under "Program Files\Microsoft.NET\SDK\CompactFramework\v3.5\WindowsCE\Microsoft.Windowsce.Forms.dll".
    • Marked as answer by eryang Friday, October 9, 2009 3:53 AM
    Friday, September 25, 2009 4:44 PM
  • Don't add references to Microsoft.WindowsCE, they are not going to be available on the target machine.  If you want a Windows LOGFONT, just declare it yourself:

    using System.Runtime.InteropServices;
    ...
        [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
        public class LOGFONT {
            public int lfHeight;
            public int lfWidth;
            public int lfEscapement;
            public int lfOrientation;
            public int lfWeight;
            public byte lfItalic;
            public byte lfUnderline;
            public byte lfStrikeOut;
            public byte lfCharSet;
            public byte lfOutPrecision;
            public byte lfClipPrecision;
            public byte lfQuality;
            public byte lfPitchAndFamily;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x20)]
            public string lfFaceName;
        }


    Hans Passant.
    Friday, September 25, 2009 7:12 PM
    Moderator