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
- ActivityExecutionContextCollection.cs
- DeferredSelectedIndexReference.cs
- ControlSerializer.cs
- TokenBasedSet.cs
- RelationshipWrapper.cs
- SmiEventSink.cs
- TransformValueSerializer.cs
- UnionCodeGroup.cs
- VScrollProperties.cs
- AddIn.cs
- GeneralTransform2DTo3D.cs
- GlobalizationSection.cs
- ApplicationServiceManager.cs
- CompressionTransform.cs
- SqlBuilder.cs
- ProfilePropertySettingsCollection.cs
- XmlIgnoreAttribute.cs
- SafeNativeMethods.cs
- TracingConnection.cs
- StateFinalizationDesigner.cs
- DocumentGridPage.cs
- SectionInput.cs
- TimeSpanFormat.cs
- SqlUDTStorage.cs
- DetailsView.cs
- HttpCapabilitiesEvaluator.cs
- ServiceDeploymentInfo.cs
- SecureEnvironment.cs
- PropertyTab.cs
- InvalidPropValue.cs
- StaticResourceExtension.cs
- WsiProfilesElement.cs
- EventsTab.cs
- HandleCollector.cs
- FormsAuthenticationTicket.cs
- InternalBase.cs
- TcpChannelHelper.cs
- RoutedEventHandlerInfo.cs
- ProfessionalColors.cs
- SqlCommandSet.cs
- DesignerActionGlyph.cs
- ControlParser.cs
- SupportsEventValidationAttribute.cs
- LabelLiteral.cs
- COSERVERINFO.cs
- RadioButtonBaseAdapter.cs
- BrowserDefinition.cs
- DataKey.cs
- CorrelationManager.cs
- _NativeSSPI.cs
- CodeIdentifiers.cs
- IUnknownConstantAttribute.cs
- CrossContextChannel.cs
- WebConfigurationHostFileChange.cs
- SizeAnimationBase.cs
- GetWinFXPath.cs
- DataGridViewTextBoxEditingControl.cs
- HostingEnvironment.cs
- TextAction.cs
- PersistChildrenAttribute.cs
- TranslateTransform.cs
- DataGridHeadersVisibilityToVisibilityConverter.cs
- UnsignedPublishLicense.cs
- ResourceManagerWrapper.cs
- CaseInsensitiveComparer.cs
- BaseParagraph.cs
- RecordBuilder.cs
- OdbcCommand.cs
- Msmq4PoisonHandler.cs
- PeerResolverBindingElement.cs
- TextRangeAdaptor.cs
- InputBindingCollection.cs
- AsymmetricKeyExchangeFormatter.cs
- DataGridViewCellCollection.cs
- LambdaCompiler.cs
- CodeTypeDeclaration.cs
- CalendarDay.cs
- DataGridRowAutomationPeer.cs
- BinaryWriter.cs
- WindowsImpersonationContext.cs
- ClientSideProviderDescription.cs
- SchemaHelper.cs
- PointCollectionConverter.cs
- MemberMaps.cs
- RuleProcessor.cs
- PeekCompletedEventArgs.cs
- MethodAccessException.cs
- WhitespaceRule.cs
- ToggleProviderWrapper.cs
- DataGridDefaultColumnWidthTypeConverter.cs
- WebPartTransformer.cs
- BrowserCapabilitiesCompiler.cs
- Misc.cs
- HwndAppCommandInputProvider.cs
- Stylus.cs
- SqlDataSourceTableQuery.cs
- XmlSchemas.cs
- XmlDataCollection.cs
- XDeferredAxisSource.cs
- ConfigurationStrings.cs