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
- ProfilePropertyMetadata.cs
- PieceDirectory.cs
- DictionaryItemsCollection.cs
- RuleSettingsCollection.cs
- NamespaceDisplayAutomationPeer.cs
- UpdatePanelControlTrigger.cs
- AssertSection.cs
- GridViewDeleteEventArgs.cs
- TypeDescriptorFilterService.cs
- RelatedView.cs
- GlyphElement.cs
- PriorityChain.cs
- DataGridViewCheckBoxColumn.cs
- TdsParser.cs
- StringFreezingAttribute.cs
- Scripts.cs
- CacheChildrenQuery.cs
- MediaTimeline.cs
- SecurityRuntime.cs
- NullableDecimalAverageAggregationOperator.cs
- DictionaryGlobals.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- Style.cs
- ParameterEditorUserControl.cs
- XmlCharType.cs
- SvcMapFileSerializer.cs
- DesignerSerializerAttribute.cs
- CodeGenerationManager.cs
- ListDictionaryInternal.cs
- RegexReplacement.cs
- WebHttpBindingElement.cs
- PointAnimationClockResource.cs
- ClientEventManager.cs
- XPathDocumentNavigator.cs
- AuthStoreRoleProvider.cs
- ContextMenuService.cs
- Parallel.cs
- WindowsHyperlink.cs
- ProjectionCamera.cs
- WebBrowsableAttribute.cs
- NameTable.cs
- ContentPlaceHolder.cs
- AsyncDataRequest.cs
- QilTypeChecker.cs
- ImageIndexConverter.cs
- DiagnosticTrace.cs
- BinaryObjectReader.cs
- CalendarDataBindingHandler.cs
- SetStateDesigner.cs
- SecondaryViewProvider.cs
- HMACSHA256.cs
- DbReferenceCollection.cs
- EntityFrameworkVersions.cs
- FixedSOMSemanticBox.cs
- ColumnHeader.cs
- OperationCanceledException.cs
- ArrayWithOffset.cs
- PaintValueEventArgs.cs
- ProfileProvider.cs
- LinqToSqlWrapper.cs
- TextAdaptor.cs
- HelpInfo.cs
- CompareInfo.cs
- PublisherIdentityPermission.cs
- BatchStream.cs
- MouseEvent.cs
- HashJoinQueryOperatorEnumerator.cs
- HttpModulesSection.cs
- LambdaCompiler.ControlFlow.cs
- RenderContext.cs
- SynthesizerStateChangedEventArgs.cs
- GenerateScriptTypeAttribute.cs
- ObjectDataSourceDisposingEventArgs.cs
- ColorPalette.cs
- SizeConverter.cs
- StreamUpgradeProvider.cs
- JsonCollectionDataContract.cs
- PixelFormat.cs
- ValueOfAction.cs
- compensatingcollection.cs
- altserialization.cs
- _SSPIWrapper.cs
- ClaimTypes.cs
- MetadataUtil.cs
- ControlAdapter.cs
- GenericIdentity.cs
- EventDescriptor.cs
- ScriptDescriptor.cs
- MetadataCollection.cs
- ResolveCriteria11.cs
- XmlDocumentSerializer.cs
- XmlSchemaComplexType.cs
- BindingUtils.cs
- WebSysDefaultValueAttribute.cs
- CrossSiteScriptingValidation.cs
- MailMessage.cs
- FormCollection.cs
- formatstringdialog.cs
- codemethodreferenceexpression.cs
- ConfigurationSectionGroup.cs