Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / CommonUI / System / Drawing / Advanced / FontCollection.cs / 2 / 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
- WebEventCodes.cs
- ExportOptions.cs
- AsyncSerializedWorker.cs
- PropertyCollection.cs
- VariantWrapper.cs
- DataAdapter.cs
- BulletDecorator.cs
- OdbcConnection.cs
- RemoteEndpointMessageProperty.cs
- SingleConverter.cs
- TextTreeTextElementNode.cs
- EastAsianLunisolarCalendar.cs
- WindowsIdentity.cs
- ValueQuery.cs
- SkewTransform.cs
- JournalEntryListConverter.cs
- XmlSchemaExternal.cs
- SoapIncludeAttribute.cs
- DataListItemCollection.cs
- TextEditor.cs
- EventTask.cs
- HijriCalendar.cs
- ListViewItem.cs
- NativeMethods.cs
- Misc.cs
- Documentation.cs
- WebDescriptionAttribute.cs
- TypeLibConverter.cs
- ByValueEqualityComparer.cs
- CategoryValueConverter.cs
- RealizationDrawingContextWalker.cs
- WinFormsSecurity.cs
- TraceEventCache.cs
- RijndaelManaged.cs
- CodeParameterDeclarationExpressionCollection.cs
- IteratorDescriptor.cs
- Bits.cs
- OdbcConnectionOpen.cs
- SafeSecurityHandles.cs
- LinqDataSourceSelectEventArgs.cs
- CompoundFileStorageReference.cs
- HostedElements.cs
- DataServiceHostFactory.cs
- TrackBar.cs
- OleDbConnectionInternal.cs
- AsynchronousChannelMergeEnumerator.cs
- DataKeyCollection.cs
- PkcsMisc.cs
- Opcode.cs
- UnaryNode.cs
- LazyTextWriterCreator.cs
- BufferModesCollection.cs
- Transactions.cs
- Activity.cs
- Vector3DCollection.cs
- ResourceReader.cs
- ErrorEventArgs.cs
- PageResolution.cs
- TypeLoadException.cs
- SerializationBinder.cs
- InputMethodStateTypeInfo.cs
- XPathCompileException.cs
- GlyphRun.cs
- InstanceNotReadyException.cs
- InvokeProviderWrapper.cs
- ImageListUtils.cs
- HttpModuleActionCollection.cs
- ProcessStartInfo.cs
- CatalogZoneDesigner.cs
- TextDecorationLocationValidation.cs
- LazyTextWriterCreator.cs
- StrongNameUtility.cs
- MetadataItem.cs
- WorkflowInstance.cs
- FormatVersion.cs
- VisualTreeHelper.cs
- BitmapEffectInput.cs
- Baml2006ReaderSettings.cs
- MailWriter.cs
- EventItfInfo.cs
- _DigestClient.cs
- XsdCachingReader.cs
- SystemFonts.cs
- InvokeHandlers.cs
- ISO2022Encoding.cs
- Ops.cs
- EntitySqlQueryCacheKey.cs
- HorizontalAlignConverter.cs
- RichTextBox.cs
- elementinformation.cs
- SelectQueryOperator.cs
- HttpCookie.cs
- HttpTransportBindingElement.cs
- ModuleElement.cs
- SubpageParagraph.cs
- MLangCodePageEncoding.cs
- FloaterBaseParagraph.cs
- HashMembershipCondition.cs
- _AutoWebProxyScriptWrapper.cs
- XhtmlBasicImageAdapter.cs