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
- ComAdminWrapper.cs
- StrokeNode.cs
- BindingExpressionUncommonField.cs
- HelpProvider.cs
- CodeLabeledStatement.cs
- TTSVoice.cs
- IdnElement.cs
- XmlSchemaSimpleTypeUnion.cs
- FontFaceLayoutInfo.cs
- FontDialog.cs
- ElementAction.cs
- InvalidPrinterException.cs
- SelectionRange.cs
- IndexingContentUnit.cs
- CaretElement.cs
- DataServiceResponse.cs
- MultiTouchSystemGestureLogic.cs
- ArrayConverter.cs
- CheckBoxRenderer.cs
- LongAverageAggregationOperator.cs
- XmlHierarchicalDataSourceView.cs
- ClientUtils.cs
- SyndicationSerializer.cs
- ShaperBuffers.cs
- IndexedString.cs
- SecurityNegotiationException.cs
- ActiveXMessageFormatter.cs
- RegexRunner.cs
- WebConfigurationManager.cs
- ScrollChrome.cs
- DataException.cs
- AssemblyBuilder.cs
- HttpListenerException.cs
- RowParagraph.cs
- ThousandthOfEmRealPoints.cs
- TrackingStringDictionary.cs
- UrlAuthorizationModule.cs
- RangeValidator.cs
- Int32CAMarshaler.cs
- SqlDataReader.cs
- SchemaTableColumn.cs
- SingleBodyParameterMessageFormatter.cs
- AmbientValueAttribute.cs
- ComboBox.cs
- DefaultObjectSerializer.cs
- SqlBulkCopy.cs
- HtmlUtf8RawTextWriter.cs
- Int32CollectionConverter.cs
- ContextDataSource.cs
- ConnectionPoolManager.cs
- XsdValidatingReader.cs
- TreeNodeCollectionEditor.cs
- TransformerTypeCollection.cs
- _CookieModule.cs
- ApplicationContext.cs
- AccessibleObject.cs
- connectionpool.cs
- GridViewPageEventArgs.cs
- FixedSOMTable.cs
- ChildDocumentBlock.cs
- PreApplicationStartMethodAttribute.cs
- ReadOnlyDataSourceView.cs
- SettingsSection.cs
- TemplateControl.cs
- ActivityTypeDesigner.xaml.cs
- RegionIterator.cs
- _CacheStreams.cs
- EncodingInfo.cs
- DynamicControl.cs
- EventOpcode.cs
- Page.cs
- DocumentSchemaValidator.cs
- QueryCacheKey.cs
- VerticalAlignConverter.cs
- ResourcesChangeInfo.cs
- Repeater.cs
- ReadOnlyAttribute.cs
- DataGridViewRowEventArgs.cs
- OdbcCommandBuilder.cs
- FileDialogCustomPlace.cs
- SmtpReplyReader.cs
- __Error.cs
- Clock.cs
- NativeWindow.cs
- CompilerState.cs
- CompressEmulationStream.cs
- BrowserCapabilitiesFactoryBase.cs
- ModifierKeysConverter.cs
- NgenServicingAttributes.cs
- BaseProcessProtocolHandler.cs
- EnumBuilder.cs
- EditorAttribute.cs
- SafeEventLogWriteHandle.cs
- MultipleViewPatternIdentifiers.cs
- SrgsSemanticInterpretationTag.cs
- TdsParserStateObject.cs
- OdbcErrorCollection.cs
- SwitchAttribute.cs
- NameValueConfigurationCollection.cs
- DataGridViewTopLeftHeaderCell.cs