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
- StylusLogic.cs
- ObjectTypeMapping.cs
- ContextToken.cs
- NumericUpDownAccelerationCollection.cs
- ContainerControl.cs
- ObjectComplexPropertyMapping.cs
- XmlFormatExtensionAttribute.cs
- AggregateNode.cs
- SiteMapNodeItemEventArgs.cs
- ListItemParagraph.cs
- LineGeometry.cs
- GuidConverter.cs
- Point3DValueSerializer.cs
- OracleBFile.cs
- AddressHeaderCollection.cs
- AutomationProperty.cs
- SchemaEntity.cs
- Debugger.cs
- Hyperlink.cs
- RelatedView.cs
- GridProviderWrapper.cs
- BindingContext.cs
- BoundsDrawingContextWalker.cs
- XmlSerializerFactory.cs
- ExpressionBuilderCollection.cs
- FilterRepeater.cs
- FontWeightConverter.cs
- SurrogateSelector.cs
- OneToOneMappingSerializer.cs
- SEHException.cs
- WebPartsSection.cs
- WorkflowInstanceSuspendedRecord.cs
- SystemInfo.cs
- Vector3DConverter.cs
- FlatButtonAppearance.cs
- JpegBitmapEncoder.cs
- SamlAdvice.cs
- ContentValidator.cs
- Permission.cs
- XmlSchemaType.cs
- Process.cs
- DataServiceQueryOfT.cs
- precedingsibling.cs
- WebGetAttribute.cs
- DictionarySectionHandler.cs
- GZipObjectSerializer.cs
- InkCanvasAutomationPeer.cs
- MemberProjectionIndex.cs
- SharedStatics.cs
- BitmapFrame.cs
- RegistryPermission.cs
- PermissionAttributes.cs
- AnnotationAdorner.cs
- GC.cs
- _UncName.cs
- ComAdminInterfaces.cs
- ProcessHostConfigUtils.cs
- ApplicationDirectory.cs
- MenuBase.cs
- BitmapEffectInput.cs
- XmlNamespaceDeclarationsAttribute.cs
- XmlSerializationGeneratedCode.cs
- OutputCacheProfileCollection.cs
- ProfileBuildProvider.cs
- PolicyLevel.cs
- SQLDateTimeStorage.cs
- WebPartEditorOkVerb.cs
- DrawTreeNodeEventArgs.cs
- RequestCacheEntry.cs
- DurationConverter.cs
- InvalidOperationException.cs
- SudsCommon.cs
- UriTemplateEquivalenceComparer.cs
- Simplifier.cs
- QilChoice.cs
- Converter.cs
- ProfileSettingsCollection.cs
- DoubleAnimationClockResource.cs
- EdmProviderManifest.cs
- ArraySubsetEnumerator.cs
- DesignTimeVisibleAttribute.cs
- SaveFileDialog.cs
- webeventbuffer.cs
- TripleDESCryptoServiceProvider.cs
- PackageFilter.cs
- EventLogEntryCollection.cs
- FigureParagraph.cs
- BooleanStorage.cs
- CodeCastExpression.cs
- DefaultShape.cs
- AdCreatedEventArgs.cs
- ManagedCodeMarkers.cs
- SubtreeProcessor.cs
- DynamicValueConverter.cs
- BaseDataList.cs
- LoginName.cs
- MiniParameterInfo.cs
- EntityParameter.cs
- XmlUrlResolver.cs
- BookmarkUndoUnit.cs