Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / CommonUI / System / Drawing / PropertyItemInternal.cs / 1 / 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
- UseAttributeSetsAction.cs
- RecognizerInfo.cs
- FixedSOMTableCell.cs
- CodeObject.cs
- CapabilitiesUse.cs
- QilSortKey.cs
- PolicyException.cs
- BaseTemplateParser.cs
- RangeValuePatternIdentifiers.cs
- HttpFormatExtensions.cs
- TextRangeBase.cs
- NotifyIcon.cs
- HwndSubclass.cs
- InvalidEnumArgumentException.cs
- TemplateKeyConverter.cs
- AuthenticationModuleElementCollection.cs
- CollectionView.cs
- URL.cs
- SrgsRuleRef.cs
- EmptyControlCollection.cs
- MultiPageTextView.cs
- NativeWindow.cs
- CatalogPartChrome.cs
- BuildProvidersCompiler.cs
- FixedSOMLineCollection.cs
- COM2EnumConverter.cs
- JavaScriptString.cs
- CreateParams.cs
- BrowserCapabilitiesCodeGenerator.cs
- RoleBoolean.cs
- HtmlButton.cs
- RightsManagementPermission.cs
- ColorAnimation.cs
- SafeLocalMemHandle.cs
- InstanceOwner.cs
- ValidationSummary.cs
- AdCreatedEventArgs.cs
- IssuanceLicense.cs
- LocatorGroup.cs
- SqlCacheDependencyDatabaseCollection.cs
- FixedDocumentPaginator.cs
- BufferModesCollection.cs
- FigureParaClient.cs
- CurrentTimeZone.cs
- SizeAnimationUsingKeyFrames.cs
- DbParameterHelper.cs
- PixelFormats.cs
- AxHost.cs
- linebase.cs
- SqlProfileProvider.cs
- HitTestParameters.cs
- TextBounds.cs
- SchemaTypeEmitter.cs
- DetailsViewPageEventArgs.cs
- TemplateControlBuildProvider.cs
- XmlAnyAttributeAttribute.cs
- InfoCardRSACryptoProvider.cs
- ACL.cs
- Evidence.cs
- TransactionProtocol.cs
- DataChangedEventManager.cs
- DefaultPropertyAttribute.cs
- DesignRelation.cs
- TrackPoint.cs
- ImageIndexConverter.cs
- ActiveXContainer.cs
- ListControlConvertEventArgs.cs
- PropertyValueChangedEvent.cs
- DropAnimation.xaml.cs
- DefaultProxySection.cs
- SplitterCancelEvent.cs
- RawKeyboardInputReport.cs
- DataRecordInternal.cs
- PeerServiceMessageContracts.cs
- ConfigXmlSignificantWhitespace.cs
- SafeNativeMethodsOther.cs
- XmlSchemaCompilationSettings.cs
- Hex.cs
- MouseActionValueSerializer.cs
- XNodeSchemaApplier.cs
- PerfProviderCollection.cs
- HandlerElement.cs
- ToolStripPanelCell.cs
- COM2IProvidePropertyBuilderHandler.cs
- XmlDigitalSignatureProcessor.cs
- HelpHtmlBuilder.cs
- NetworkInformationPermission.cs
- RawTextInputReport.cs
- Menu.cs
- ExceptionHandlers.cs
- ThemeableAttribute.cs
- DataGridViewAutoSizeColumnsModeEventArgs.cs
- SessionSwitchEventArgs.cs
- NonParentingControl.cs
- TimeZoneNotFoundException.cs
- CanonicalFontFamilyReference.cs
- Pen.cs
- BaseParser.cs
- RepeatInfo.cs
- ExtensibleClassFactory.cs