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
- QuaternionAnimation.cs
- AttachedAnnotationChangedEventArgs.cs
- basemetadatamappingvisitor.cs
- ProfileSection.cs
- ToolStripSplitButton.cs
- StrokeNodeOperations2.cs
- _SSPIWrapper.cs
- LingerOption.cs
- InertiaRotationBehavior.cs
- OdbcConnectionStringbuilder.cs
- ClaimComparer.cs
- SecurityTokenRequirement.cs
- FilteredSchemaElementLookUpTable.cs
- StaticSiteMapProvider.cs
- RegistrySecurity.cs
- SystemIPv6InterfaceProperties.cs
- XPathDocumentIterator.cs
- RootBrowserWindowProxy.cs
- WindowsProgressbar.cs
- XmlConvert.cs
- DynamicVirtualDiscoSearcher.cs
- RuntimeEnvironment.cs
- DataTable.cs
- ProfileEventArgs.cs
- SchemaImporter.cs
- EventBindingService.cs
- DateTimeAutomationPeer.cs
- _AutoWebProxyScriptHelper.cs
- AppDomainProtocolHandler.cs
- FSWPathEditor.cs
- OpCodes.cs
- TailCallAnalyzer.cs
- X509CertificateStore.cs
- IdentitySection.cs
- TreeNodeCollection.cs
- WorkItem.cs
- Border.cs
- MetadataCache.cs
- HMACMD5.cs
- AttributeData.cs
- OracleBoolean.cs
- ClientRuntime.cs
- EntityDataSourceReferenceGroup.cs
- NamespaceDecl.cs
- DbDeleteCommandTree.cs
- ExportOptions.cs
- PathData.cs
- safemediahandle.cs
- PathSegmentCollection.cs
- HtmlTableRowCollection.cs
- _SslState.cs
- QueryOptionExpression.cs
- WebPartEditVerb.cs
- SQLGuid.cs
- JsonCollectionDataContract.cs
- HostUtils.cs
- AssertUtility.cs
- WebResourceUtil.cs
- FreezableDefaultValueFactory.cs
- _BasicClient.cs
- EnglishPluralizationService.cs
- RecognizeCompletedEventArgs.cs
- StrokeCollectionConverter.cs
- ErrorWrapper.cs
- KnownBoxes.cs
- externdll.cs
- ImportedNamespaceContextItem.cs
- PrimitiveCodeDomSerializer.cs
- ConnectionPool.cs
- AsyncDataRequest.cs
- TextEditorTyping.cs
- __Error.cs
- SqlConnectionString.cs
- WebRequestModuleElement.cs
- AsymmetricCryptoHandle.cs
- SimpleType.cs
- QuadraticEase.cs
- InstancePersistenceCommand.cs
- RouteValueExpressionBuilder.cs
- OleDbParameterCollection.cs
- SafeRightsManagementEnvironmentHandle.cs
- DataGridRowHeader.cs
- XmlAnyAttributeAttribute.cs
- SqlDataSourceStatusEventArgs.cs
- controlskin.cs
- WebServicesInteroperability.cs
- GacUtil.cs
- XsdDataContractImporter.cs
- TopClause.cs
- PageCatalogPart.cs
- ActivityCodeDomSerializer.cs
- ExtractorMetadata.cs
- StringDictionary.cs
- TextTreeInsertElementUndoUnit.cs
- IChannel.cs
- SQLString.cs
- Popup.cs
- AsyncOperationManager.cs
- DbXmlEnabledProviderManifest.cs
- ReadOnlyAttribute.cs