Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CommonUI / System / Drawing / Advanced / FontCollection.cs / 1305376 / 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; using System.Runtime.Versioning; ////// /// 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 { [ResourceExposure(ResourceScope.Process)] [ResourceConsumption(ResourceScope.Process)] 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
- TypeGeneratedEventArgs.cs
- EntityDataSourceDesigner.cs
- ReachObjectContext.cs
- ISFClipboardData.cs
- MemberInitExpression.cs
- XmlComplianceUtil.cs
- ListBindingHelper.cs
- HealthMonitoringSectionHelper.cs
- XmlSubtreeReader.cs
- XamlWrappingReader.cs
- OleDbError.cs
- SinglePageViewer.cs
- ProxyHelper.cs
- COM2PropertyDescriptor.cs
- ScrollViewer.cs
- TextRangeEditTables.cs
- RSAPKCS1SignatureFormatter.cs
- ResourceBinder.cs
- DataGridViewColumnDividerDoubleClickEventArgs.cs
- Relationship.cs
- SqlTransaction.cs
- CodeObject.cs
- IndexerNameAttribute.cs
- DBSchemaRow.cs
- CommonRemoteMemoryBlock.cs
- TextServicesDisplayAttributePropertyRanges.cs
- GridPattern.cs
- EdmToObjectNamespaceMap.cs
- DrawingCollection.cs
- CodeGenerator.cs
- SortKey.cs
- ResXDataNode.cs
- TextDecorationUnitValidation.cs
- ResolveCriteriaCD1.cs
- DataGridViewTextBoxColumn.cs
- UnionCodeGroup.cs
- ElementAction.cs
- GridViewRow.cs
- Point3DCollection.cs
- DragDeltaEventArgs.cs
- ExternalFile.cs
- basenumberconverter.cs
- SpellCheck.cs
- cookiecollection.cs
- CodePrimitiveExpression.cs
- CompilationLock.cs
- _BasicClient.cs
- ExpressionStringBuilder.cs
- GestureRecognitionResult.cs
- ToolStripItemEventArgs.cs
- ColorTransformHelper.cs
- OleDbSchemaGuid.cs
- Deflater.cs
- LocalValueEnumerator.cs
- ChangeInterceptorAttribute.cs
- LOSFormatter.cs
- XamlReaderConstants.cs
- SchemaElementLookUpTable.cs
- HttpWebRequestElement.cs
- SQLGuid.cs
- XmlExtensionFunction.cs
- PackageDigitalSignature.cs
- CustomErrorCollection.cs
- SQLGuidStorage.cs
- NavigationCommands.cs
- HyperLinkStyle.cs
- pingexception.cs
- DocumentReference.cs
- HtmlTableRow.cs
- ButtonFlatAdapter.cs
- PrimitiveType.cs
- SchemaDeclBase.cs
- NavigationPropertyAccessor.cs
- ActiveXHost.cs
- Int32Storage.cs
- WindowsToolbar.cs
- SignatureResourcePool.cs
- ETagAttribute.cs
- SqlProviderServices.cs
- SafeNativeMethods.cs
- InputScopeNameConverter.cs
- DataGrid.cs
- IImplicitResourceProvider.cs
- XmlSchemaInferenceException.cs
- MailAddress.cs
- XmlSchemaInferenceException.cs
- UserControlParser.cs
- VBIdentifierTrimConverter.cs
- Executor.cs
- SafeHGlobalHandleCritical.cs
- ActivityExecutionContextCollection.cs
- ListViewSelectEventArgs.cs
- SendingRequestEventArgs.cs
- LookupNode.cs
- AssociationSetEnd.cs
- WindowsUserNameSecurityTokenAuthenticator.cs
- AddInControllerImpl.cs
- RectConverter.cs
- AssemblyNameProxy.cs
- TrustSection.cs