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
- DesignerActionUIService.cs
- SmuggledIUnknown.cs
- SchemaDeclBase.cs
- XamlTreeBuilderBamlRecordWriter.cs
- DescendantOverDescendantQuery.cs
- ValueUnavailableException.cs
- ToolStripRendererSwitcher.cs
- diagnosticsswitches.cs
- AnnotationComponentChooser.cs
- Win32SafeHandles.cs
- MetadataCache.cs
- CompositeCollection.cs
- ArrangedElementCollection.cs
- NameTable.cs
- WindowsImpersonationContext.cs
- HMACMD5.cs
- AnnouncementEndpoint.cs
- WorkflowShape.cs
- ListViewTableCell.cs
- CapacityStreamGeometryContext.cs
- CatalogZoneBase.cs
- Registry.cs
- Model3DCollection.cs
- SecurityManager.cs
- BaseCodeDomTreeGenerator.cs
- PackageRelationshipSelector.cs
- HashHelpers.cs
- codemethodreferenceexpression.cs
- EmbeddedMailObjectsCollection.cs
- QueryAccessibilityHelpEvent.cs
- Clipboard.cs
- ErrorWrapper.cs
- InputElement.cs
- StagingAreaInputItem.cs
- DataGridColumnDropSeparator.cs
- PreviewControlDesigner.cs
- RegexGroup.cs
- SQLStringStorage.cs
- SqlDataSourceCommandEventArgs.cs
- SmtpNegotiateAuthenticationModule.cs
- DiscreteKeyFrames.cs
- _LocalDataStoreMgr.cs
- SafeLocalMemHandle.cs
- ExtensionFile.cs
- XmlUtf8RawTextWriter.cs
- DetailsView.cs
- LinqDataSourceValidationException.cs
- EntityProviderServices.cs
- URI.cs
- DynamicVirtualDiscoSearcher.cs
- loginstatus.cs
- ConditionalWeakTable.cs
- MainMenu.cs
- InnerItemCollectionView.cs
- EntityFrameworkVersions.cs
- AssemblyAssociatedContentFileAttribute.cs
- IISUnsafeMethods.cs
- XmlCharCheckingReader.cs
- DetailsViewCommandEventArgs.cs
- DayRenderEvent.cs
- HitTestResult.cs
- LoaderAllocator.cs
- ProcessInputEventArgs.cs
- SQLUtility.cs
- coordinatorscratchpad.cs
- UnauthorizedAccessException.cs
- SendActivityDesigner.cs
- ObjectKeyFrameCollection.cs
- QilTypeChecker.cs
- DetailsViewActionList.cs
- Verify.cs
- Solver.cs
- __TransparentProxy.cs
- HwndStylusInputProvider.cs
- XmlChildEnumerator.cs
- FastEncoderWindow.cs
- BamlVersionHeader.cs
- ClaimTypes.cs
- WindowsEditBox.cs
- tooltip.cs
- SchemaElementLookUpTable.cs
- ReadOnlyCollectionBase.cs
- Transform.cs
- TypeResolvingOptions.cs
- OrderingQueryOperator.cs
- Publisher.cs
- Documentation.cs
- SessionStateSection.cs
- ContractHandle.cs
- UnsafeNativeMethods.cs
- FixedNode.cs
- InputBinder.cs
- PersonalizableTypeEntry.cs
- SoapMessage.cs
- ExtentJoinTreeNode.cs
- TemplateAction.cs
- AssociationTypeEmitter.cs
- RoleManagerSection.cs
- BridgeDataReader.cs
- FormsAuthenticationModule.cs