Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CommonUI / System / Drawing / PropertyItemInternal.cs / 1305376 / PropertyItemInternal.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Drawing.Imaging { using System.Runtime.InteropServices; using System; using System.Drawing; // sdkinc\imaging.h [StructLayout(LayoutKind.Sequential)] internal sealed class PropertyItemInternal : IDisposable { public int id; public int len; public short type; public IntPtr value = IntPtr.Zero; internal PropertyItemInternal() { } ~PropertyItemInternal() { Dispose(false); } public void Dispose() { Dispose(true); } private void Dispose(bool disposing) { if (value != IntPtr.Zero) { Marshal.FreeHGlobal(value); value = IntPtr.Zero; } if( disposing ) { GC.SuppressFinalize(this); } } internal static PropertyItemInternal ConvertFromPropertyItem(PropertyItem propItem) { PropertyItemInternal propItemInternal = new PropertyItemInternal(); propItemInternal.id = propItem.Id; propItemInternal.len = propItem.Len; propItemInternal.type = propItem.Type; byte[] propItemValue = propItem.Value; if (propItemValue != null) { propItemInternal.value = Marshal.AllocHGlobal(propItemValue.Length); Marshal.Copy(propItemValue, 0, propItemInternal.value, propItemValue.Length); } return propItemInternal; } internal static PropertyItem[] ConvertFromMemory(IntPtr propdata, int count) { PropertyItem[] props = new PropertyItem[count]; for (int i=0; i// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Drawing.Imaging { using System.Runtime.InteropServices; using System; using System.Drawing; // sdkinc\imaging.h [StructLayout(LayoutKind.Sequential)] internal sealed class PropertyItemInternal : IDisposable { public int id; public int len; public short type; public IntPtr value = IntPtr.Zero; internal PropertyItemInternal() { } ~PropertyItemInternal() { Dispose(false); } public void Dispose() { Dispose(true); } private void Dispose(bool disposing) { if (value != IntPtr.Zero) { Marshal.FreeHGlobal(value); value = IntPtr.Zero; } if( disposing ) { GC.SuppressFinalize(this); } } internal static PropertyItemInternal ConvertFromPropertyItem(PropertyItem propItem) { PropertyItemInternal propItemInternal = new PropertyItemInternal(); propItemInternal.id = propItem.Id; propItemInternal.len = propItem.Len; propItemInternal.type = propItem.Type; byte[] propItemValue = propItem.Value; if (propItemValue != null) { propItemInternal.value = Marshal.AllocHGlobal(propItemValue.Length); Marshal.Copy(propItemValue, 0, propItemInternal.value, propItemValue.Length); } return propItemInternal; } internal static PropertyItem[] ConvertFromMemory(IntPtr propdata, int count) { PropertyItem[] props = new PropertyItem[count]; for (int i=0; i
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- BamlResourceSerializer.cs
- SoapDocumentMethodAttribute.cs
- IODescriptionAttribute.cs
- HasCopySemanticsAttribute.cs
- PasswordTextNavigator.cs
- ZoneIdentityPermission.cs
- BitmapData.cs
- Delegate.cs
- ParameterReplacerVisitor.cs
- DataGridViewCellFormattingEventArgs.cs
- LabelLiteral.cs
- ConnectionOrientedTransportChannelListener.cs
- DataGridViewColumnHeaderCell.cs
- DataGridTextColumn.cs
- ContainerControlDesigner.cs
- CommandField.cs
- BooleanToVisibilityConverter.cs
- AspNetHostingPermission.cs
- MailAddressCollection.cs
- DataGridViewLayoutData.cs
- FormViewInsertedEventArgs.cs
- WebErrorHandler.cs
- ListView.cs
- PeerNodeAddress.cs
- QueryOperator.cs
- Transform.cs
- HwndSourceParameters.cs
- ResetableIterator.cs
- HttpWebResponse.cs
- EndEvent.cs
- StringInfo.cs
- TextEditorTyping.cs
- VirtualPathData.cs
- UnsettableComboBox.cs
- AssemblyUtil.cs
- Attributes.cs
- TabControlDesigner.cs
- XmlSchemaParticle.cs
- Bitmap.cs
- StaticExtension.cs
- CoreSwitches.cs
- InvalidStoreProtectionKeyException.cs
- ImageSource.cs
- ComponentSerializationService.cs
- FontUnit.cs
- WebBrowserSiteBase.cs
- UnicodeEncoding.cs
- ObjectDisposedException.cs
- Point.cs
- AppDomainGrammarProxy.cs
- CompilerError.cs
- SystemIcmpV4Statistics.cs
- WebPartsPersonalizationAuthorization.cs
- CompareInfo.cs
- Drawing.cs
- EditorZoneBase.cs
- ProgressBarHighlightConverter.cs
- base64Transforms.cs
- XmlSerializerSection.cs
- TableLayoutColumnStyleCollection.cs
- DrawingImage.cs
- SapiGrammar.cs
- OfTypeExpression.cs
- AnimationStorage.cs
- OdbcEnvironment.cs
- UpDownBase.cs
- WebConfigurationFileMap.cs
- ListViewHitTestInfo.cs
- NameSpaceExtractor.cs
- ModelPropertyDescriptor.cs
- PointConverter.cs
- TypeSystem.cs
- Input.cs
- SqlCacheDependencyDatabaseCollection.cs
- DllNotFoundException.cs
- ISAPIWorkerRequest.cs
- ParseNumbers.cs
- AttributeExtensions.cs
- SiteMapPath.cs
- RefType.cs
- WindowsFont.cs
- Semaphore.cs
- ExpressionVisitorHelpers.cs
- AuthenticationModuleElement.cs
- EditModeSwitchButton.cs
- invalidudtexception.cs
- ExitEventArgs.cs
- EncryptedPackage.cs
- RC2CryptoServiceProvider.cs
- Fx.cs
- ObjectStateEntryBaseUpdatableDataRecord.cs
- TextDecorations.cs
- DbModificationCommandTree.cs
- HostingEnvironmentSection.cs
- WS2007FederationHttpBindingElement.cs
- IERequestCache.cs
- MultipartContentParser.cs
- WebControl.cs
- CloudCollection.cs
- RemoteWebConfigurationHostStream.cs