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
- ADMembershipUser.cs
- ScriptingJsonSerializationSection.cs
- SystemDropShadowChrome.cs
- UIElementPropertyUndoUnit.cs
- HandleCollector.cs
- BitmapEffectInputData.cs
- RequestCachePolicyConverter.cs
- DataGridViewHitTestInfo.cs
- ComplusTypeValidator.cs
- TextBoxAutoCompleteSourceConverter.cs
- StringAnimationUsingKeyFrames.cs
- Track.cs
- DataQuery.cs
- Point.cs
- ReadWriteObjectLock.cs
- BinaryMethodMessage.cs
- CodeParameterDeclarationExpression.cs
- StateDesigner.CommentLayoutGlyph.cs
- DataServiceProviderMethods.cs
- WebHeaderCollection.cs
- arc.cs
- WsdlBuildProvider.cs
- ObjectSet.cs
- NativeMethods.cs
- BookmarkUndoUnit.cs
- AlphabeticalEnumConverter.cs
- FieldAccessException.cs
- OverrideMode.cs
- SQLInt64Storage.cs
- PrinterUnitConvert.cs
- TreeNodeConverter.cs
- StateMachineWorkflowInstance.cs
- DesignerDataConnection.cs
- MetadataItemCollectionFactory.cs
- ContainerCodeDomSerializer.cs
- NavigationService.cs
- ByteFacetDescriptionElement.cs
- SqlRowUpdatingEvent.cs
- PriorityQueue.cs
- BitmapDownload.cs
- DataGridItemAttachedStorage.cs
- _CacheStreams.cs
- XmlSchemaSequence.cs
- SrgsElementList.cs
- EventPropertyMap.cs
- EntityCommandCompilationException.cs
- AnchorEditor.cs
- Privilege.cs
- Helper.cs
- ScaleTransform.cs
- XsdValidatingReader.cs
- CachedPathData.cs
- HScrollBar.cs
- FontStyleConverter.cs
- DataBindingList.cs
- SafeRightsManagementQueryHandle.cs
- ActivityExecutorOperation.cs
- AttachInfo.cs
- XComponentModel.cs
- SqlProfileProvider.cs
- PropertyEmitter.cs
- Classification.cs
- DefaultEvaluationContext.cs
- StructuredTypeEmitter.cs
- ComboBoxAutomationPeer.cs
- OletxEnlistment.cs
- RegexWriter.cs
- DataGridPagingPage.cs
- TrackingStringDictionary.cs
- TreePrinter.cs
- keycontainerpermission.cs
- HttpCacheVary.cs
- Version.cs
- CompileLiteralTextParser.cs
- HtmlPhoneCallAdapter.cs
- SelectionProviderWrapper.cs
- ComboBox.cs
- SqlBulkCopy.cs
- MetaModel.cs
- UserPersonalizationStateInfo.cs
- ImageFormat.cs
- ToolStripSplitButton.cs
- CodeTypeReferenceExpression.cs
- ToolStripMenuItem.cs
- AttachedProperty.cs
- VBCodeProvider.cs
- PropertyRecord.cs
- UserPreferenceChangedEventArgs.cs
- GridViewPageEventArgs.cs
- DesigntimeLicenseContext.cs
- HttpCacheVary.cs
- SolidColorBrush.cs
- WebAdminConfigurationHelper.cs
- Rotation3DAnimation.cs
- GeometryModel3D.cs
- Vector3DValueSerializer.cs
- Application.cs
- WebPartConnectionsCloseVerb.cs
- ApplicationId.cs
- Transform.cs