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
- AutomationIdentifierGuids.cs
- MarshalDirectiveException.cs
- CalendarDateRange.cs
- ContentType.cs
- RegexCharClass.cs
- Literal.cs
- NameGenerator.cs
- PartialCachingAttribute.cs
- SyndicationItem.cs
- SetStoryboardSpeedRatio.cs
- CurrentChangedEventManager.cs
- RightNameExpirationInfoPair.cs
- ToggleButtonAutomationPeer.cs
- future.cs
- RandomDelayQueuedSendsAsyncResult.cs
- FlowDocumentReaderAutomationPeer.cs
- safelink.cs
- TokenBasedSetEnumerator.cs
- FontUnitConverter.cs
- ChangeTracker.cs
- PreProcessInputEventArgs.cs
- RoleGroupCollection.cs
- _ProxyRegBlob.cs
- StrokeCollection.cs
- SimpleFieldTemplateUserControl.cs
- RawTextInputReport.cs
- IntegrationExceptionEventArgs.cs
- OracleConnectionFactory.cs
- OrderByQueryOptionExpression.cs
- DragCompletedEventArgs.cs
- DesignerMetadata.cs
- ProviderException.cs
- AmbientLight.cs
- CharacterMetricsDictionary.cs
- DataProtection.cs
- x509utils.cs
- MSAAWinEventWrap.cs
- TextServicesCompartmentEventSink.cs
- MemberInitExpression.cs
- TextFindEngine.cs
- Pair.cs
- DocumentCollection.cs
- NonVisualControlAttribute.cs
- CrossSiteScriptingValidation.cs
- LocationReference.cs
- BadImageFormatException.cs
- MissingManifestResourceException.cs
- DataGridViewLinkColumn.cs
- UnicastIPAddressInformationCollection.cs
- CngUIPolicy.cs
- ParagraphVisual.cs
- SqlDuplicator.cs
- ParseNumbers.cs
- PixelShader.cs
- DependencyPropertyAttribute.cs
- DBDataPermission.cs
- RTLAwareMessageBox.cs
- DrawingContextWalker.cs
- InputLangChangeEvent.cs
- GridViewColumnCollectionChangedEventArgs.cs
- UnsafeNativeMethodsCLR.cs
- DataGridCommandEventArgs.cs
- GCHandleCookieTable.cs
- OrderPreservingSpoolingTask.cs
- SqlBuilder.cs
- XmlSchemaAttributeGroupRef.cs
- TextServicesPropertyRanges.cs
- MetafileHeaderWmf.cs
- CssStyleCollection.cs
- WebResourceUtil.cs
- Menu.cs
- SqlDataSourceView.cs
- SimpleTextLine.cs
- PresentationUIStyleResources.cs
- BevelBitmapEffect.cs
- WebPartCatalogCloseVerb.cs
- TreeNode.cs
- ClientTarget.cs
- MetaColumn.cs
- Brush.cs
- RegexFCD.cs
- Pkcs9Attribute.cs
- SmtpException.cs
- CursorConverter.cs
- ThicknessAnimation.cs
- WinInet.cs
- ScriptResourceAttribute.cs
- SignatureGenerator.cs
- HttpRequestMessageProperty.cs
- BitmapEffect.cs
- SerialReceived.cs
- EnvelopeVersion.cs
- TileModeValidation.cs
- ClientOptions.cs
- StringPropertyBuilder.cs
- TextBreakpoint.cs
- FilterQuery.cs
- TemplateManager.cs
- KnownBoxes.cs
- RightNameExpirationInfoPair.cs