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
- Base64Encoder.cs
- TimelineClockCollection.cs
- ConsoleKeyInfo.cs
- MatrixAnimationUsingPath.cs
- PerformanceCounterManager.cs
- Rotation3D.cs
- SetStateEventArgs.cs
- ReversePositionQuery.cs
- SqlOuterApplyReducer.cs
- TableLayoutStyle.cs
- Profiler.cs
- RotateTransform.cs
- XmlUnspecifiedAttribute.cs
- PointHitTestResult.cs
- UInt16Converter.cs
- ElementAction.cs
- ControlPropertyNameConverter.cs
- ModifiableIteratorCollection.cs
- GraphicsState.cs
- CollectionViewGroupRoot.cs
- CodeSnippetTypeMember.cs
- QueryAccessibilityHelpEvent.cs
- XmlWrappingReader.cs
- FrugalList.cs
- CommandBindingCollection.cs
- TrustLevelCollection.cs
- AttributedMetaModel.cs
- DataMisalignedException.cs
- GeneratedView.cs
- WsatServiceAddress.cs
- NestPullup.cs
- ExpandCollapseProviderWrapper.cs
- UrlMappingsSection.cs
- WpfWebRequestHelper.cs
- Exceptions.cs
- InstalledFontCollection.cs
- Hex.cs
- BrowserDefinition.cs
- Single.cs
- PointKeyFrameCollection.cs
- GenericAuthenticationEventArgs.cs
- DetailsView.cs
- StrongNameIdentityPermission.cs
- Attachment.cs
- XmlSchemaIdentityConstraint.cs
- ToolStripDropDownItem.cs
- XmlSchemaAll.cs
- TextPointer.cs
- EmptyReadOnlyDictionaryInternal.cs
- StrongNamePublicKeyBlob.cs
- XPathMultyIterator.cs
- SBCSCodePageEncoding.cs
- StateManager.cs
- XmlSchemaCollection.cs
- AutoGeneratedField.cs
- SoapFault.cs
- ApplicationServiceManager.cs
- TreeView.cs
- GridView.cs
- TrackingMemoryStreamFactory.cs
- KeyValueConfigurationElement.cs
- FlowDocumentScrollViewer.cs
- ToolStripProgressBar.cs
- DataGridViewButtonCell.cs
- DataGridViewCellStyleChangedEventArgs.cs
- LostFocusEventManager.cs
- PerfProviderCollection.cs
- ConfigurationManagerInternal.cs
- FixedSOMTextRun.cs
- DeferredBinaryDeserializerExtension.cs
- AutomationPeer.cs
- WinFormsUtils.cs
- TdsParameterSetter.cs
- DataGridViewLayoutData.cs
- HttpProtocolImporter.cs
- PropertyValueChangedEvent.cs
- ListViewItemMouseHoverEvent.cs
- TableItemStyle.cs
- Region.cs
- WebPartManagerInternals.cs
- RemoteX509Token.cs
- _ConnectionGroup.cs
- BuildManager.cs
- ExecutionEngineException.cs
- TextTrailingWordEllipsis.cs
- EventToken.cs
- UnaryOperationBinder.cs
- SignatureHelper.cs
- FixedSOMImage.cs
- TemplateBindingExpression.cs
- XmlSchemaObject.cs
- PolyLineSegment.cs
- WebColorConverter.cs
- UrlRoutingModule.cs
- GACMembershipCondition.cs
- ToolStripDropTargetManager.cs
- ObsoleteAttribute.cs
- SymbolPair.cs
- MarginCollapsingState.cs
- DataGridViewRowHeightInfoNeededEventArgs.cs