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
- CacheDict.cs
- SetterBase.cs
- MdiWindowListStrip.cs
- Operator.cs
- Compiler.cs
- SystemException.cs
- SchemaImporter.cs
- Effect.cs
- xmlsaver.cs
- PersonalizableTypeEntry.cs
- DbConnectionPool.cs
- HtmlLink.cs
- TypeTypeConverter.cs
- DirectoryNotFoundException.cs
- ReceiveCompletedEventArgs.cs
- HtmlContainerControl.cs
- NullRuntimeConfig.cs
- SqlCaseSimplifier.cs
- TraceSource.cs
- ByteAnimation.cs
- RemoteWebConfigurationHostServer.cs
- MarkupCompilePass1.cs
- TextEditorTyping.cs
- EffectiveValueEntry.cs
- ActivationArguments.cs
- SiteMapNodeItem.cs
- WeakReference.cs
- CompilerGlobalScopeAttribute.cs
- OrderByLifter.cs
- DragStartedEventArgs.cs
- IssuanceLicense.cs
- ScriptingSectionGroup.cs
- FamilyTypefaceCollection.cs
- SByte.cs
- CodeIdentifier.cs
- BaseCollection.cs
- Frame.cs
- DataGridViewSelectedCellsAccessibleObject.cs
- ConstructorExpr.cs
- WebPartAddingEventArgs.cs
- HtmlUtf8RawTextWriter.cs
- EndpointAddressMessageFilterTable.cs
- GeometryModel3D.cs
- PageStatePersister.cs
- CqlBlock.cs
- UmAlQuraCalendar.cs
- DataGridSortCommandEventArgs.cs
- Rect3DConverter.cs
- PrivilegeNotHeldException.cs
- IDispatchConstantAttribute.cs
- TypedReference.cs
- JsonFormatWriterGenerator.cs
- PerformanceCounterPermission.cs
- DiscoveryDocumentReference.cs
- MenuAdapter.cs
- DocumentGridPage.cs
- DataGridrowEditEndingEventArgs.cs
- SqlDataSourceConfigureFilterForm.cs
- BindingExpressionBase.cs
- Simplifier.cs
- UnknownWrapper.cs
- BackStopAuthenticationModule.cs
- ElementInit.cs
- Size.cs
- AutoResetEvent.cs
- PropertyGridCommands.cs
- EventListener.cs
- HttpResponse.cs
- DBConnectionString.cs
- SchemaMapping.cs
- EntityClientCacheEntry.cs
- FamilyTypeface.cs
- ContentOnlyMessage.cs
- OperationCanceledException.cs
- OpenFileDialog.cs
- webproxy.cs
- RegistryKey.cs
- RadioButton.cs
- CollectionChangeEventArgs.cs
- WebPartCatalogAddVerb.cs
- HttpRuntimeSection.cs
- ToolBarOverflowPanel.cs
- MarginsConverter.cs
- XamlValidatingReader.cs
- LockCookie.cs
- StringValueSerializer.cs
- ShaderEffect.cs
- ApplicationActivator.cs
- SafeThreadHandle.cs
- TypeConverterValueSerializer.cs
- FeatureAttribute.cs
- DesigntimeLicenseContext.cs
- ValidatorAttribute.cs
- DockingAttribute.cs
- CodeSnippetCompileUnit.cs
- HttpCapabilitiesBase.cs
- ZoneIdentityPermission.cs
- Odbc32.cs
- COM2IVsPerPropertyBrowsingHandler.cs
- WebPartConnection.cs