Code:
/ 4.0 / 4.0 / 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 ( ///). /// // 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
- RepeaterItem.cs
- QilFunction.cs
- StringAnimationBase.cs
- JumpTask.cs
- Line.cs
- PointLightBase.cs
- AdRotatorDesigner.cs
- ExpandoClass.cs
- DataSourceBooleanViewSchemaConverter.cs
- InertiaRotationBehavior.cs
- AppModelKnownContentFactory.cs
- SecurityElement.cs
- DataKey.cs
- RemotingServices.cs
- ProjectionPruner.cs
- UserControl.cs
- CodeSnippetStatement.cs
- RolePrincipal.cs
- JsonReaderDelegator.cs
- UrlPath.cs
- RowSpanVector.cs
- RepeatInfo.cs
- DispatcherEventArgs.cs
- DataGridTableCollection.cs
- JpegBitmapDecoder.cs
- TypeBuilderInstantiation.cs
- ResourcePropertyMemberCodeDomSerializer.cs
- DBCommandBuilder.cs
- LineSegment.cs
- StrokeCollectionDefaultValueFactory.cs
- SmtpMail.cs
- DbgUtil.cs
- SerializationAttributes.cs
- ReliableDuplexSessionChannel.cs
- ColorTranslator.cs
- mediapermission.cs
- SqlError.cs
- PropertyGrid.cs
- MethodBody.cs
- MemberRelationshipService.cs
- FontStretch.cs
- ExcCanonicalXml.cs
- DbMetaDataCollectionNames.cs
- OuterGlowBitmapEffect.cs
- XamlParser.cs
- HasCopySemanticsAttribute.cs
- SymbolMethod.cs
- Compiler.cs
- BlockCollection.cs
- RootBrowserWindowProxy.cs
- QilStrConcat.cs
- ModuleElement.cs
- XmlSchemaSet.cs
- TypeDescriptor.cs
- EntityDataReader.cs
- PersonalizationProvider.cs
- OdbcReferenceCollection.cs
- Guid.cs
- X509ScopedServiceCertificateElement.cs
- PropertyItemInternal.cs
- FieldToken.cs
- ScriptDescriptor.cs
- CursorConverter.cs
- ReferencedAssemblyResolver.cs
- StreamWithDictionary.cs
- CriticalHandle.cs
- DataControlFieldCollection.cs
- EnvironmentPermission.cs
- RootBrowserWindow.cs
- GlyphingCache.cs
- PluggableProtocol.cs
- DispatcherSynchronizationContext.cs
- IdentityElement.cs
- ActivityCodeDomSerializer.cs
- RenderTargetBitmap.cs
- CalendarData.cs
- TraceHandler.cs
- WindowsFont.cs
- TraceFilter.cs
- IgnoreSectionHandler.cs
- BitFlagsGenerator.cs
- RegexRunner.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- ListBoxItemAutomationPeer.cs
- HtmlTextArea.cs
- GridViewCommandEventArgs.cs
- log.cs
- Int64AnimationBase.cs
- NamespaceDecl.cs
- MSAAEventDispatcher.cs
- StringUtil.cs
- oledbmetadatacolumnnames.cs
- ConfigurationValues.cs
- UIElement3D.cs
- VirtualizingStackPanel.cs
- HttpCacheVary.cs
- EventLogQuery.cs
- Vector3D.cs
- DBSchemaRow.cs
- TreeNodeClickEventArgs.cs