Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / CommonUI / System / Drawing / Advanced / FontCollection.cs / 1 / FontCollection.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Drawing.Text { using System.Diagnostics; using System; using System.Drawing; using System.Drawing.Internal; using System.Runtime.InteropServices; using System.ComponentModel; using Microsoft.Win32; ////// /// When inherited, enumerates the FontFamily /// objects in a collection of fonts. /// public abstract class FontCollection : IDisposable { internal IntPtr nativeFontCollection; internal FontCollection() { nativeFontCollection = IntPtr.Zero; } ////// /// Disposes of this public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } ////// protected virtual void Dispose(bool disposing) { // nothing... } /// /// /// public FontFamily[] Families { get { int numSought = 0; int status = SafeNativeMethods.Gdip.GdipGetFontCollectionFamilyCount(new HandleRef(this, nativeFontCollection), out numSought); if (status != SafeNativeMethods.Gdip.Ok) throw SafeNativeMethods.Gdip.StatusException(status); IntPtr[] gpfamilies = new IntPtr[numSought]; int numFound = 0; status = SafeNativeMethods.Gdip.GdipGetFontCollectionFamilyList(new HandleRef(this, nativeFontCollection), numSought, gpfamilies, out numFound); if (status != SafeNativeMethods.Gdip.Ok) throw SafeNativeMethods.Gdip.StatusException(status); Debug.Assert(numSought == numFound, "GDI+ can't give a straight answer about how many fonts there are"); FontFamily[] families = new FontFamily[numFound]; for (int f = 0; f < numFound; f++) { IntPtr native; SafeNativeMethods.Gdip.GdipCloneFontFamily(new HandleRef(null, (IntPtr)gpfamilies[f]), out native); families[f] = new FontFamily(native); } return families; } } /** * Object cleanup */ ////// Gets the array of ////// objects associated with this . /// /// /// ~FontCollection() { Dispose(false); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ ///// Allows an object to free resources before the object is /// reclaimed by the Garbage Collector ( ///). /// // Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Drawing.Text { using System.Diagnostics; using System; using System.Drawing; using System.Drawing.Internal; using System.Runtime.InteropServices; using System.ComponentModel; using Microsoft.Win32; ////// /// When inherited, enumerates the FontFamily /// objects in a collection of fonts. /// public abstract class FontCollection : IDisposable { internal IntPtr nativeFontCollection; internal FontCollection() { nativeFontCollection = IntPtr.Zero; } ////// /// Disposes of this public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } ////// protected virtual void Dispose(bool disposing) { // nothing... } /// /// /// public FontFamily[] Families { get { int numSought = 0; int status = SafeNativeMethods.Gdip.GdipGetFontCollectionFamilyCount(new HandleRef(this, nativeFontCollection), out numSought); if (status != SafeNativeMethods.Gdip.Ok) throw SafeNativeMethods.Gdip.StatusException(status); IntPtr[] gpfamilies = new IntPtr[numSought]; int numFound = 0; status = SafeNativeMethods.Gdip.GdipGetFontCollectionFamilyList(new HandleRef(this, nativeFontCollection), numSought, gpfamilies, out numFound); if (status != SafeNativeMethods.Gdip.Ok) throw SafeNativeMethods.Gdip.StatusException(status); Debug.Assert(numSought == numFound, "GDI+ can't give a straight answer about how many fonts there are"); FontFamily[] families = new FontFamily[numFound]; for (int f = 0; f < numFound; f++) { IntPtr native; SafeNativeMethods.Gdip.GdipCloneFontFamily(new HandleRef(null, (IntPtr)gpfamilies[f]), out native); families[f] = new FontFamily(native); } return families; } } /** * Object cleanup */ ////// Gets the array of ////// objects associated with this . /// /// /// ~FontCollection() { Dispose(false); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007./// Allows an object to free resources before the object is /// reclaimed by the Garbage Collector ( ///). ///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- EntityDataSourceReferenceGroup.cs
- XmlSchemaAny.cs
- ChangeDirector.cs
- Pen.cs
- ComPlusInstanceContextInitializer.cs
- DecoderFallback.cs
- DivideByZeroException.cs
- DependencyPropertyDescriptor.cs
- ColumnReorderedEventArgs.cs
- HwndSourceKeyboardInputSite.cs
- SemanticAnalyzer.cs
- MonthChangedEventArgs.cs
- InvalidComObjectException.cs
- ResXBuildProvider.cs
- EndOfStreamException.cs
- KeysConverter.cs
- BackStopAuthenticationModule.cs
- BaseProcessor.cs
- WindowsHyperlink.cs
- DesignTimeHTMLTextWriter.cs
- HtmlInputPassword.cs
- XmlArrayItemAttributes.cs
- DelegateHelpers.cs
- ClassDataContract.cs
- TagMapCollection.cs
- CreateUserErrorEventArgs.cs
- Switch.cs
- Cursors.cs
- SafeViewOfFileHandle.cs
- ControlAdapter.cs
- Config.cs
- HandleRef.cs
- FlowLayout.cs
- GroupedContextMenuStrip.cs
- ClientTargetSection.cs
- ConfigurationStrings.cs
- DateTimeFormatInfo.cs
- WebReferenceCollection.cs
- SmtpCommands.cs
- MILUtilities.cs
- InkPresenter.cs
- StreamGeometryContext.cs
- TypeConverterHelper.cs
- sapiproxy.cs
- SqlProviderManifest.cs
- WindowShowOrOpenTracker.cs
- EmptyImpersonationContext.cs
- Receive.cs
- UpDownEvent.cs
- CharacterShapingProperties.cs
- ValidatorCollection.cs
- FlowDocumentFormatter.cs
- ApplicationActivator.cs
- DataDocumentXPathNavigator.cs
- ComPlusThreadInitializer.cs
- _BasicClient.cs
- Partitioner.cs
- LinkClickEvent.cs
- GroupStyle.cs
- SqlConnectionHelper.cs
- ADConnectionHelper.cs
- PathFigure.cs
- cookiecollection.cs
- XPathSelectionIterator.cs
- ThreadStateException.cs
- DecimalAnimationBase.cs
- UnsafeNativeMethods.cs
- BrowserCapabilitiesCodeGenerator.cs
- SplineQuaternionKeyFrame.cs
- mda.cs
- VBIdentifierDesigner.xaml.cs
- WebPartManager.cs
- CultureTable.cs
- VisualBasicReference.cs
- XmlBaseWriter.cs
- TransformerInfo.cs
- XPathQilFactory.cs
- RuntimeWrappedException.cs
- Point3DAnimationUsingKeyFrames.cs
- NullableConverter.cs
- ElementInit.cs
- DynamicResourceExtension.cs
- XamlStyleSerializer.cs
- AttributeData.cs
- CharacterBuffer.cs
- DBConnection.cs
- UpWmlPageAdapter.cs
- XmlSchemaAny.cs
- InitializationEventAttribute.cs
- DataSvcMapFileSerializer.cs
- CryptographicAttribute.cs
- PatternMatchRules.cs
- ProtocolsSection.cs
- Common.cs
- ServiceBehaviorAttribute.cs
- ExpressionConverter.cs
- Executor.cs
- SystemException.cs
- QilScopedVisitor.cs
- ChameleonKey.cs