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
- ShellProvider.cs
- EventSetter.cs
- TargetControlTypeAttribute.cs
- CommonProperties.cs
- FormView.cs
- ImmutableObjectAttribute.cs
- Point3DCollection.cs
- XMLUtil.cs
- List.cs
- TypedDatasetGenerator.cs
- UnicastIPAddressInformationCollection.cs
- PrintingPermissionAttribute.cs
- SoapException.cs
- XmlQueryType.cs
- Scripts.cs
- XmlQueryStaticData.cs
- SafeProcessHandle.cs
- RegexCharClass.cs
- BitmapVisualManager.cs
- StateManagedCollection.cs
- PaperSource.cs
- SystemDropShadowChrome.cs
- WsdlHelpGeneratorElement.cs
- Journal.cs
- _ListenerResponseStream.cs
- DragCompletedEventArgs.cs
- SQLDoubleStorage.cs
- KeyValueConfigurationElement.cs
- TemplateBuilder.cs
- PolicyValidationException.cs
- TrackingMemoryStreamFactory.cs
- HandleRef.cs
- AdapterDictionary.cs
- DesignTimeVisibleAttribute.cs
- InternalCache.cs
- XPathNodeList.cs
- DetailsViewDeleteEventArgs.cs
- ExpandCollapseProviderWrapper.cs
- TypeExtensionSerializer.cs
- LongValidator.cs
- StdValidatorsAndConverters.cs
- DataGridHyperlinkColumn.cs
- AbstractDataSvcMapFileLoader.cs
- HttpContext.cs
- PropertyEmitter.cs
- CompoundFileStorageReference.cs
- ImageProxy.cs
- SuppressMessageAttribute.cs
- ModelTreeEnumerator.cs
- objectquery_tresulttype.cs
- TextSimpleMarkerProperties.cs
- Int32AnimationBase.cs
- BitmapInitialize.cs
- InternalResources.cs
- EncryptedData.cs
- DependencyPropertyChangedEventArgs.cs
- ComponentConverter.cs
- MouseEvent.cs
- PartBasedPackageProperties.cs
- DrawingCollection.cs
- FormViewUpdatedEventArgs.cs
- DbConnectionPoolIdentity.cs
- NullableConverter.cs
- OrderingInfo.cs
- ConfigurationProperty.cs
- SoapCommonClasses.cs
- Vector3dCollection.cs
- QuotedPrintableStream.cs
- ListView.cs
- ObjectItemCollectionAssemblyCacheEntry.cs
- EventBuilder.cs
- GenericUI.cs
- BindingValueChangedEventArgs.cs
- SelectManyQueryOperator.cs
- TableChangeProcessor.cs
- EdmTypeAttribute.cs
- UnsafeNativeMethods.cs
- UiaCoreApi.cs
- ColumnMapTranslator.cs
- HandlerFactoryWrapper.cs
- SmtpException.cs
- SessionStateUtil.cs
- AnimationLayer.cs
- ServicePointManagerElement.cs
- TypeSystem.cs
- TemplatingOptionsDialog.cs
- PrePostDescendentsWalker.cs
- DictionaryCustomTypeDescriptor.cs
- Baml6Assembly.cs
- LineUtil.cs
- ToolStripMenuItem.cs
- DetailsViewDeleteEventArgs.cs
- ComNativeDescriptor.cs
- ResourceDisplayNameAttribute.cs
- SqlBuffer.cs
- GridViewRowPresenterBase.cs
- LoginViewDesigner.cs
- WorkflowTransactionService.cs
- TableLayoutPanelDesigner.cs
- TextDecorationCollection.cs