Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / CommonUI / System / Drawing / PropertyItemInternal.cs / 1 / 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
- FormatterServicesNoSerializableCheck.cs
- DataGridViewColumnConverter.cs
- BooleanProjectedSlot.cs
- PenThreadWorker.cs
- EmptyReadOnlyDictionaryInternal.cs
- Latin1Encoding.cs
- DataServiceProcessingPipeline.cs
- TextHintingModeValidation.cs
- DefaultWorkflowLoaderService.cs
- UserInitiatedRoutedEventPermissionAttribute.cs
- ServiceMetadataExtension.cs
- ProfilePropertyMetadata.cs
- _NtlmClient.cs
- LocatorGroup.cs
- FunctionQuery.cs
- SizeKeyFrameCollection.cs
- BindingList.cs
- AliasExpr.cs
- SoapObjectWriter.cs
- regiisutil.cs
- InternalDispatchObject.cs
- TokenBasedSetEnumerator.cs
- EnumBuilder.cs
- ProfileService.cs
- TimeoutHelper.cs
- EpmSourcePathSegment.cs
- ExecutedRoutedEventArgs.cs
- BaseCAMarshaler.cs
- ReferenceSchema.cs
- WebPartMinimizeVerb.cs
- DataServiceRequestOfT.cs
- ScalarConstant.cs
- FontStyle.cs
- QilIterator.cs
- CmsInterop.cs
- BufferBuilder.cs
- CompiledIdentityConstraint.cs
- InputLangChangeEvent.cs
- ProfileModule.cs
- _NtlmClient.cs
- EntityContainer.cs
- OdbcException.cs
- UseLicense.cs
- FontUnitConverter.cs
- XmlArrayItemAttribute.cs
- ChainOfResponsibility.cs
- ExtendedPropertyDescriptor.cs
- ProxyHwnd.cs
- SiteOfOriginContainer.cs
- HtmlInputControl.cs
- BitmapMetadataBlob.cs
- WebServiceEndpoint.cs
- StringPropertyBuilder.cs
- WorkflowDesignerColors.cs
- OdbcFactory.cs
- DeviceSpecific.cs
- SocketCache.cs
- ComponentConverter.cs
- XmlAnyElementAttribute.cs
- TypeSystem.cs
- CollectionBuilder.cs
- TextInfo.cs
- FileIOPermission.cs
- SafeWaitHandle.cs
- CryptoConfig.cs
- ListViewInsertedEventArgs.cs
- Material.cs
- ApplyTemplatesAction.cs
- MaskedTextBoxTextEditor.cs
- HttpContext.cs
- MemberProjectionIndex.cs
- recordstate.cs
- HijriCalendar.cs
- XmlResolver.cs
- EventMappingSettingsCollection.cs
- TdsParserStaticMethods.cs
- UnsafeNativeMethods.cs
- DatePickerDateValidationErrorEventArgs.cs
- DataGridLength.cs
- CommandBindingCollection.cs
- Graphics.cs
- TextTreeTextBlock.cs
- RectangleF.cs
- Decoder.cs
- ExpressionConverter.cs
- HuffCodec.cs
- QuestionEventArgs.cs
- FixedSOMTableRow.cs
- CodeDelegateInvokeExpression.cs
- FileFormatException.cs
- AutomationProperty.cs
- TextBoxView.cs
- GeometryModel3D.cs
- XmlLanguage.cs
- SynchronizedDispatch.cs
- Frame.cs
- DaylightTime.cs
- TypedDataSetSchemaImporterExtension.cs
- ObjectTokenCategory.cs
- DataBinding.cs