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
- BinHexEncoder.cs
- TableParagraph.cs
- ParamArrayAttribute.cs
- Decoder.cs
- BackgroundFormatInfo.cs
- DbDataRecord.cs
- TextDocumentView.cs
- CornerRadiusConverter.cs
- CertificateReferenceElement.cs
- IssuedTokensHeader.cs
- ApplicationException.cs
- InfoCardHelper.cs
- DecoderFallback.cs
- FunctionImportElement.cs
- QueryContinueDragEventArgs.cs
- ProcessProtocolHandler.cs
- MessageBox.cs
- HttpRuntimeSection.cs
- LinqDataView.cs
- HitTestFilterBehavior.cs
- TreeNodeSelectionProcessor.cs
- ObjectListGeneralPage.cs
- IsolatedStorageFile.cs
- EdmMember.cs
- OlePropertyStructs.cs
- ByteStack.cs
- DataGridViewComboBoxEditingControl.cs
- AuthenticationService.cs
- RtfToXamlLexer.cs
- SignatureHelper.cs
- TableDetailsCollection.cs
- JsonQNameDataContract.cs
- EncoderParameter.cs
- Point4D.cs
- ChannelBinding.cs
- TextElementAutomationPeer.cs
- Variant.cs
- WebFormDesignerActionService.cs
- TiffBitmapDecoder.cs
- GradientSpreadMethodValidation.cs
- XmlParserContext.cs
- GestureRecognizer.cs
- TextSchema.cs
- LinkArea.cs
- Manipulation.cs
- SettingsProperty.cs
- MLangCodePageEncoding.cs
- HMACSHA384.cs
- SizeIndependentAnimationStorage.cs
- ConnectionsZoneDesigner.cs
- ComponentDispatcher.cs
- SafeLibraryHandle.cs
- OLEDB_Util.cs
- GZipStream.cs
- Opcode.cs
- DocumentSchemaValidator.cs
- LinearQuaternionKeyFrame.cs
- ResXDataNode.cs
- StringSorter.cs
- XmlSchemaChoice.cs
- BindingBase.cs
- XmlTypeMapping.cs
- CodeAttributeArgumentCollection.cs
- DataPointer.cs
- HttpBrowserCapabilitiesBase.cs
- ClientFormsIdentity.cs
- WebPartsSection.cs
- DrawingGroupDrawingContext.cs
- InstanceDataCollection.cs
- DataGridItem.cs
- SignatureResourceHelper.cs
- ZoneButton.cs
- CssClassPropertyAttribute.cs
- OdbcErrorCollection.cs
- XmlSchemaAppInfo.cs
- OciLobLocator.cs
- SortFieldComparer.cs
- _CookieModule.cs
- EpmCustomContentWriterNodeData.cs
- StringKeyFrameCollection.cs
- Calendar.cs
- WindowsStartMenu.cs
- TraceXPathNavigator.cs
- ExceptionUtil.cs
- AlphaSortedEnumConverter.cs
- XmlnsDefinitionAttribute.cs
- ComplexObject.cs
- UIHelper.cs
- DrawingImage.cs
- CopyAttributesAction.cs
- XdrBuilder.cs
- SqlBooleanMismatchVisitor.cs
- XmlSortKeyAccumulator.cs
- MethodBuilder.cs
- HttpSocketManager.cs
- hresults.cs
- CodeMethodReturnStatement.cs
- DataControlFieldsEditor.cs
- TreeNodeBindingCollection.cs
- SQLDateTimeStorage.cs