예제 #1
0
        public void AddFontFile(string filename)
        {
            IntSecurity.DemandReadFileIO(filename);
            int status = SafeNativeMethods.Gdip.GdipPrivateAddFontFile(new HandleRef(this, base.nativeFontCollection), filename);

            if (status != 0)
            {
                throw SafeNativeMethods.Gdip.StatusException(status);
            }
            SafeNativeMethods.AddFontFile(filename);
        }
예제 #2
0
        /// <include file='doc\PrivateFontCollection.uex' path='docs/doc[@for="PrivateFontCollection.AddFontFile"]/*' />
        /// <devdoc>
        ///    <para>
        ///       Adds a font from the specified file to
        ///       this <see cref='System.Drawing.Text.PrivateFontCollection'/>.
        ///    </para>
        /// </devdoc>
        public void AddFontFile(string filename)
        {
            int status = SafeNativeMethods.Gdip.GdipPrivateAddFontFile(new HandleRef(this, nativeFontCollection), filename);

            if (status != SafeNativeMethods.Gdip.Ok)
            {
                throw SafeNativeMethods.Gdip.StatusException(status);
            }

            // Register private font with GDI as well so pure GDI-based controls (TextBox, Button for instance) can access it.
            SafeNativeMethods.AddFontFile(filename);
        }
예제 #3
0
        /// <include file='doc\PrivateFontCollection.uex' path='docs/doc[@for="PrivateFontCollection.AddFontFile"]/*' />
        /// <devdoc>
        ///    <para>
        ///       Adds a font from the specified file to
        ///       this <see cref='System.Drawing.Text.PrivateFontCollection'/>.
        ///    </para>
        /// </devdoc>
        public void AddFontFile(string filename)
        {
            IntSecurity.DemandReadFileIO(filename);
            int status = SafeNativeMethods.Gdip.GdipPrivateAddFontFile(new HandleRef(this, nativeFontCollection), filename);

            if (status != SafeNativeMethods.Gdip.Ok)
            {
                throw SafeNativeMethods.Gdip.StatusException(status);
            }

            // Register private font with GDI as well so pure GDI-based controls (TextBox, Button for instance) can access it.
            if (SafeNativeMethods.AddFontFile(filename) != 0)
            {
                if (gdiFonts != null)
                {
                    gdiFonts.Add(filename);
                }
            }
        }
 private void GdiAddFontFile(string filename)
 {
     SafeNativeMethods.AddFontFile(filename);
 }