示例#1
0
        public Font(Type font)
        {
            IntPtr fontHandle;

            switch (font)
            {
            case Type.Small:
                fontHandle = GDImport.gdFontGetSmall();
                break;

            case Type.Large:
                fontHandle = GDImport.gdFontGetLarge();
                break;

            case Type.MediumBold:
                fontHandle = GDImport.gdFontGetMediumBold();
                break;

            case Type.Giant:
                fontHandle = GDImport.gdFontGetGiant();
                break;

            case Type.Tiny:
                fontHandle = GDImport.gdFontGetTiny();
                break;

            default:
                throw new ApplicationException(font + " is no valid font.");
            }

            if (fontHandle == IntPtr.Zero)
            {
                throw new ApplicationException("The font retrieval failed.");
            }

            this.handle = new HandleRef(this, fontHandle);
        }