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
- StartUpEventArgs.cs
- HtmlElementEventArgs.cs
- CapiSafeHandles.cs
- XmlUTF8TextWriter.cs
- FileDialogCustomPlace.cs
- ChangesetResponse.cs
- XomlCompiler.cs
- ValidationManager.cs
- ChangesetResponse.cs
- ComponentRenameEvent.cs
- MailAddress.cs
- TemplateNameScope.cs
- ReturnValue.cs
- RelationshipEndMember.cs
- ExtensionFile.cs
- WebPartEventArgs.cs
- GridViewActionList.cs
- SimpleType.cs
- GridErrorDlg.cs
- ChannelBase.cs
- EpmSourcePathSegment.cs
- ScriptRef.cs
- CodeGenerationManager.cs
- StructuralObject.cs
- HwndKeyboardInputProvider.cs
- RichTextBoxContextMenu.cs
- VarRefManager.cs
- SecurityElementBase.cs
- HtmlInputButton.cs
- WinFormsUtils.cs
- NotFiniteNumberException.cs
- BezierSegment.cs
- XmlSerializer.cs
- UserControlBuildProvider.cs
- CommonProperties.cs
- StylusPointPropertyInfo.cs
- ProcessModelInfo.cs
- AccessKeyManager.cs
- KoreanLunisolarCalendar.cs
- RegisterInfo.cs
- util.cs
- AdapterUtil.cs
- EnterpriseServicesHelper.cs
- FormsAuthenticationCredentials.cs
- _NegoState.cs
- XmlResolver.cs
- DataObjectMethodAttribute.cs
- bidPrivateBase.cs
- BitmapFrame.cs
- ResourceExpressionBuilder.cs
- WorkflowItemsPresenter.cs
- WebBaseEventKeyComparer.cs
- WebConvert.cs
- ShaperBuffers.cs
- AdCreatedEventArgs.cs
- SystemInfo.cs
- LongValidator.cs
- FormsAuthenticationCredentials.cs
- EncodingTable.cs
- SpellerHighlightLayer.cs
- TextDecorationCollection.cs
- WorkflowServiceInstance.cs
- DesignRelationCollection.cs
- _SafeNetHandles.cs
- LinqDataSourceValidationException.cs
- UpdatePanelControlTrigger.cs
- ReadOnlyPermissionSet.cs
- DependencyObjectProvider.cs
- ObjectDataSource.cs
- SqlCacheDependencyDatabase.cs
- _StreamFramer.cs
- EntityClassGenerator.cs
- MatrixKeyFrameCollection.cs
- NamespaceEmitter.cs
- Focus.cs
- LinkButton.cs
- DataDocumentXPathNavigator.cs
- EditorPartDesigner.cs
- SaveWorkflowAsyncResult.cs
- TypeConverterValueSerializer.cs
- DoubleAnimation.cs
- ReflectionTypeLoadException.cs
- PrePostDescendentsWalker.cs
- TdsParserSafeHandles.cs
- SizeConverter.cs
- FrameworkPropertyMetadata.cs
- MexHttpBindingElement.cs
- HttpRuntime.cs
- WindowsAuthenticationEventArgs.cs
- ListViewGroupItemCollection.cs
- ConfigurationManager.cs
- DEREncoding.cs
- StructuredTypeEmitter.cs
- Console.cs
- HwndHostAutomationPeer.cs
- TaskSchedulerException.cs
- ElementsClipboardData.cs
- ElementMarkupObject.cs
- Events.cs
- DropShadowBitmapEffect.cs