Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / CommonUI / System / Drawing / PropertyItemInternal.cs / 2 / 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
- DurableErrorHandler.cs
- CommonProperties.cs
- GridSplitterAutomationPeer.cs
- TextEditorTyping.cs
- TemplateInstanceAttribute.cs
- X509LogoTypeExtension.cs
- MonthChangedEventArgs.cs
- DropSource.cs
- BigIntegerStorage.cs
- TextTreeRootTextBlock.cs
- CanonicalizationDriver.cs
- RestClientProxyHandler.cs
- ContextStaticAttribute.cs
- XslException.cs
- PeerInvitationResponse.cs
- IFlowDocumentViewer.cs
- DynamicValueConverter.cs
- FilterException.cs
- EditorResources.cs
- RichTextBox.cs
- DataGridItem.cs
- FixedPageStructure.cs
- WebPartConnectionsEventArgs.cs
- MailHeaderInfo.cs
- SqlNamer.cs
- UriTemplateVariablePathSegment.cs
- OleDbFactory.cs
- TextElementEnumerator.cs
- AnnotationResource.cs
- SevenBitStream.cs
- DeflateStream.cs
- Input.cs
- DataMemberConverter.cs
- MessagePartProtectionMode.cs
- DataTableReaderListener.cs
- LongCountAggregationOperator.cs
- TableProviderWrapper.cs
- BindingsCollection.cs
- SerializationStore.cs
- SchemaSetCompiler.cs
- BinaryObjectInfo.cs
- SrgsSemanticInterpretationTag.cs
- XmlTextReaderImpl.cs
- SimpleTypesSurrogate.cs
- XamlStackWriter.cs
- SrgsElementList.cs
- ManagementEventWatcher.cs
- XslAst.cs
- ArrangedElement.cs
- TaiwanLunisolarCalendar.cs
- DecimalConstantAttribute.cs
- PackWebRequestFactory.cs
- InstanceDataCollectionCollection.cs
- TabItemAutomationPeer.cs
- HybridDictionary.cs
- DefaultTextStoreTextComposition.cs
- storepermission.cs
- datacache.cs
- ThemeableAttribute.cs
- BaseParser.cs
- WsdlHelpGeneratorElement.cs
- DependencyPropertyAttribute.cs
- IsolatedStorageFile.cs
- DocumentReferenceCollection.cs
- DataGridViewCellMouseEventArgs.cs
- Lease.cs
- TreeNodeClickEventArgs.cs
- CombinedGeometry.cs
- CopyNodeSetAction.cs
- MostlySingletonList.cs
- HostTimeoutsElement.cs
- CryptoKeySecurity.cs
- PasswordValidationException.cs
- StateMachineWorkflow.cs
- ContentPresenter.cs
- SoapHeader.cs
- Label.cs
- QilReplaceVisitor.cs
- EmptyControlCollection.cs
- parserscommon.cs
- InvalidComObjectException.cs
- WmfPlaceableFileHeader.cs
- EntityTypeBase.cs
- Processor.cs
- TextEffect.cs
- InputProcessorProfiles.cs
- Matrix3D.cs
- MultiSelectRootGridEntry.cs
- ConfigurationValidatorAttribute.cs
- IEnumerable.cs
- UIElementParagraph.cs
- MethodImplAttribute.cs
- printdlgexmarshaler.cs
- IUnknownConstantAttribute.cs
- MetadataCache.cs
- EventManager.cs
- HiddenFieldPageStatePersister.cs
- BaseConfigurationRecord.cs
- MobileControlsSectionHandler.cs
- HwndProxyElementProvider.cs