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
- RoutedUICommand.cs
- MenuItemBindingCollection.cs
- Ray3DHitTestResult.cs
- HttpEncoder.cs
- LayoutDump.cs
- SingleStorage.cs
- StateItem.cs
- WorkflowViewService.cs
- XmlNavigatorStack.cs
- UpdatePanelTrigger.cs
- RowUpdatedEventArgs.cs
- DbMetaDataColumnNames.cs
- PropertyManager.cs
- OpenFileDialog.cs
- SizeF.cs
- WebPartUtil.cs
- MessageHeaderInfoTraceRecord.cs
- PhonemeEventArgs.cs
- MutexSecurity.cs
- SelectionPattern.cs
- HideDisabledControlAdapter.cs
- AddInStore.cs
- TdsParameterSetter.cs
- XsltArgumentList.cs
- ExpressionBuilderContext.cs
- basecomparevalidator.cs
- BitmapMetadataEnumerator.cs
- ContextMarshalException.cs
- RenderCapability.cs
- SaveFileDialog.cs
- TypeConverterAttribute.cs
- Freezable.cs
- BinaryConverter.cs
- RecognizedPhrase.cs
- SignatureHelper.cs
- SmtpLoginAuthenticationModule.cs
- TextViewSelectionProcessor.cs
- IndexedString.cs
- WmiInstallComponent.cs
- MemberInfoSerializationHolder.cs
- SystemTcpStatistics.cs
- WeakHashtable.cs
- TextPattern.cs
- MergeFilterQuery.cs
- DesignerLoader.cs
- PolyBezierSegmentFigureLogic.cs
- DynamicObject.cs
- XmlSortKey.cs
- RequestStatusBarUpdateEventArgs.cs
- TagPrefixAttribute.cs
- SecurityElement.cs
- login.cs
- Assembly.cs
- XmlUtf8RawTextWriter.cs
- SpellerHighlightLayer.cs
- TypeGeneratedEventArgs.cs
- XamlUtilities.cs
- XmlTextReader.cs
- XmlSchema.cs
- SafeHandle.cs
- MasterPageParser.cs
- HttpRawResponse.cs
- ExpressionBuilderContext.cs
- DragEvent.cs
- DataTemplate.cs
- Variant.cs
- TextMessageEncodingBindingElement.cs
- EventProxy.cs
- SQLDateTimeStorage.cs
- XmlQuerySequence.cs
- WebPartHelpVerb.cs
- DataGridRowDetailsEventArgs.cs
- DataGridState.cs
- DataGridViewSelectedColumnCollection.cs
- MemberPath.cs
- Drawing.cs
- ApplicationInterop.cs
- Int16AnimationBase.cs
- TrackingProfileCache.cs
- FileVersion.cs
- IndexedEnumerable.cs
- ipaddressinformationcollection.cs
- ShaderEffect.cs
- PersistenceIOParticipant.cs
- _NestedMultipleAsyncResult.cs
- IISUnsafeMethods.cs
- DBConcurrencyException.cs
- ObjectDataSourceWizardForm.cs
- SplitterCancelEvent.cs
- ObjectListCommandsPage.cs
- BrushMappingModeValidation.cs
- TargetParameterCountException.cs
- EntityConnectionStringBuilderItem.cs
- TextPenaltyModule.cs
- CodeDirectiveCollection.cs
- Tuple.cs
- EpmCustomContentDeSerializer.cs
- SqlDesignerDataSourceView.cs
- TrackingParameters.cs
- SelectingProviderEventArgs.cs