Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CommonUI / System / Drawing / Advanced / AdjustableArrowCap.cs / 1305376 / AdjustableArrowCap.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Drawing.Drawing2D {
using Microsoft.Win32;
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Internal;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
///
///
/// Represents an adjustable arrow-shaped line
/// cap.
///
public sealed class AdjustableArrowCap : CustomLineCap {
internal AdjustableArrowCap(IntPtr nativeCap) :
base(nativeCap) {}
///
///
/// Initializes a new instance of the class with the specified width and
/// height.
///
[ResourceExposure(ResourceScope.Process)]
[ResourceConsumption(ResourceScope.Process)]
public AdjustableArrowCap(float width,
float height) :
this(width, height, true) {}
///
///
///
/// Initializes a new instance of the class with the specified width,
/// height, and fill property.
///
///
[ResourceExposure(ResourceScope.Process)]
[ResourceConsumption(ResourceScope.Process)]
public AdjustableArrowCap(float width,
float height,
bool isFilled)
{
IntPtr nativeCap = IntPtr.Zero;
int status = SafeNativeMethods.Gdip.GdipCreateAdjustableArrowCap(
height, width, isFilled, out nativeCap);
if (status != SafeNativeMethods.Gdip.Ok)
throw SafeNativeMethods.Gdip.StatusException(status);
SetNativeLineCap(nativeCap);
}
private void _SetHeight(float height)
{
int status = SafeNativeMethods.Gdip.GdipSetAdjustableArrowCapHeight(new HandleRef(this, nativeCap), height);
if (status != SafeNativeMethods.Gdip.Ok)
throw SafeNativeMethods.Gdip.StatusException(status);
}
private float _GetHeight()
{
float height;
int status = SafeNativeMethods.Gdip.GdipGetAdjustableArrowCapHeight(new HandleRef(this, nativeCap), out height);
if (status != SafeNativeMethods.Gdip.Ok)
throw SafeNativeMethods.Gdip.StatusException(status);
return height;
}
///
///
/// Gets or sets the height of the arrow cap.
///
public float Height
{
get { return _GetHeight(); }
set { _SetHeight(value); }
}
private void _SetWidth(float width)
{
int status = SafeNativeMethods.Gdip.GdipSetAdjustableArrowCapWidth(new HandleRef(this, nativeCap), width);
if (status != SafeNativeMethods.Gdip.Ok)
throw SafeNativeMethods.Gdip.StatusException(status);
}
private float _GetWidth()
{
float width;
int status = SafeNativeMethods.Gdip.GdipGetAdjustableArrowCapWidth(new HandleRef(this, nativeCap), out width);
if (status != SafeNativeMethods.Gdip.Ok)
throw SafeNativeMethods.Gdip.StatusException(status);
return width;
}
///
///
/// Gets or sets the width of the arrow cap.
///
public float Width
{
get { return _GetWidth(); }
set { _SetWidth(value); }
}
private void _SetMiddleInset(float middleInset)
{
int status = SafeNativeMethods.Gdip.GdipSetAdjustableArrowCapMiddleInset(new HandleRef(this, nativeCap), middleInset);
if (status != SafeNativeMethods.Gdip.Ok)
throw SafeNativeMethods.Gdip.StatusException(status);
}
private float _GetMiddleInset()
{
float middleInset;
int status = SafeNativeMethods.Gdip.GdipGetAdjustableArrowCapMiddleInset(new HandleRef(this, nativeCap), out middleInset);
if (status != SafeNativeMethods.Gdip.Ok)
throw SafeNativeMethods.Gdip.StatusException(status);
return middleInset;
}
///
///
///
/// Gets or set the number of pixels between the outline of the arrow cap and the fill.
///
///
public float MiddleInset
{
get { return _GetMiddleInset(); }
set { _SetMiddleInset(value); }
}
private void _SetFillState(bool isFilled)
{
int status = SafeNativeMethods.Gdip.GdipSetAdjustableArrowCapFillState(new HandleRef(this, nativeCap), isFilled);
if (status != SafeNativeMethods.Gdip.Ok)
throw SafeNativeMethods.Gdip.StatusException(status);
}
private bool _IsFilled()
{
bool isFilled = false;
int status = SafeNativeMethods.Gdip.GdipGetAdjustableArrowCapFillState(new HandleRef(this, nativeCap), out isFilled);
if (status != SafeNativeMethods.Gdip.Ok)
throw SafeNativeMethods.Gdip.StatusException(status);
return isFilled;
}
///
///
/// Gets or sets a value indicating whether the
/// arrow cap is filled.
///
public bool Filled
{
get { return _IsFilled(); }
set { _SetFillState(value); }
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Drawing.Drawing2D {
using Microsoft.Win32;
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Internal;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
///
///
/// Represents an adjustable arrow-shaped line
/// cap.
///
public sealed class AdjustableArrowCap : CustomLineCap {
internal AdjustableArrowCap(IntPtr nativeCap) :
base(nativeCap) {}
///
///
/// Initializes a new instance of the class with the specified width and
/// height.
///
[ResourceExposure(ResourceScope.Process)]
[ResourceConsumption(ResourceScope.Process)]
public AdjustableArrowCap(float width,
float height) :
this(width, height, true) {}
///
///
///
/// Initializes a new instance of the class with the specified width,
/// height, and fill property.
///
///
[ResourceExposure(ResourceScope.Process)]
[ResourceConsumption(ResourceScope.Process)]
public AdjustableArrowCap(float width,
float height,
bool isFilled)
{
IntPtr nativeCap = IntPtr.Zero;
int status = SafeNativeMethods.Gdip.GdipCreateAdjustableArrowCap(
height, width, isFilled, out nativeCap);
if (status != SafeNativeMethods.Gdip.Ok)
throw SafeNativeMethods.Gdip.StatusException(status);
SetNativeLineCap(nativeCap);
}
private void _SetHeight(float height)
{
int status = SafeNativeMethods.Gdip.GdipSetAdjustableArrowCapHeight(new HandleRef(this, nativeCap), height);
if (status != SafeNativeMethods.Gdip.Ok)
throw SafeNativeMethods.Gdip.StatusException(status);
}
private float _GetHeight()
{
float height;
int status = SafeNativeMethods.Gdip.GdipGetAdjustableArrowCapHeight(new HandleRef(this, nativeCap), out height);
if (status != SafeNativeMethods.Gdip.Ok)
throw SafeNativeMethods.Gdip.StatusException(status);
return height;
}
///
///
/// Gets or sets the height of the arrow cap.
///
public float Height
{
get { return _GetHeight(); }
set { _SetHeight(value); }
}
private void _SetWidth(float width)
{
int status = SafeNativeMethods.Gdip.GdipSetAdjustableArrowCapWidth(new HandleRef(this, nativeCap), width);
if (status != SafeNativeMethods.Gdip.Ok)
throw SafeNativeMethods.Gdip.StatusException(status);
}
private float _GetWidth()
{
float width;
int status = SafeNativeMethods.Gdip.GdipGetAdjustableArrowCapWidth(new HandleRef(this, nativeCap), out width);
if (status != SafeNativeMethods.Gdip.Ok)
throw SafeNativeMethods.Gdip.StatusException(status);
return width;
}
///
///
/// Gets or sets the width of the arrow cap.
///
public float Width
{
get { return _GetWidth(); }
set { _SetWidth(value); }
}
private void _SetMiddleInset(float middleInset)
{
int status = SafeNativeMethods.Gdip.GdipSetAdjustableArrowCapMiddleInset(new HandleRef(this, nativeCap), middleInset);
if (status != SafeNativeMethods.Gdip.Ok)
throw SafeNativeMethods.Gdip.StatusException(status);
}
private float _GetMiddleInset()
{
float middleInset;
int status = SafeNativeMethods.Gdip.GdipGetAdjustableArrowCapMiddleInset(new HandleRef(this, nativeCap), out middleInset);
if (status != SafeNativeMethods.Gdip.Ok)
throw SafeNativeMethods.Gdip.StatusException(status);
return middleInset;
}
///
///
///
/// Gets or set the number of pixels between the outline of the arrow cap and the fill.
///
///
public float MiddleInset
{
get { return _GetMiddleInset(); }
set { _SetMiddleInset(value); }
}
private void _SetFillState(bool isFilled)
{
int status = SafeNativeMethods.Gdip.GdipSetAdjustableArrowCapFillState(new HandleRef(this, nativeCap), isFilled);
if (status != SafeNativeMethods.Gdip.Ok)
throw SafeNativeMethods.Gdip.StatusException(status);
}
private bool _IsFilled()
{
bool isFilled = false;
int status = SafeNativeMethods.Gdip.GdipGetAdjustableArrowCapFillState(new HandleRef(this, nativeCap), out isFilled);
if (status != SafeNativeMethods.Gdip.Ok)
throw SafeNativeMethods.Gdip.StatusException(status);
return isFilled;
}
///
///
/// Gets or sets a value indicating whether the
/// arrow cap is filled.
///
public bool Filled
{
get { return _IsFilled(); }
set { _SetFillState(value); }
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SqlDataSourceFilteringEventArgs.cs
- DelegateHelpers.Generated.cs
- ParamArrayAttribute.cs
- TransformCollection.cs
- xdrvalidator.cs
- OdbcReferenceCollection.cs
- BypassElementCollection.cs
- ProfileParameter.cs
- WebPartEditorOkVerb.cs
- DataMisalignedException.cs
- FragmentQuery.cs
- StoreItemCollection.cs
- MimeMultiPart.cs
- DiagnosticEventProvider.cs
- ActiveDocumentEvent.cs
- ObjectNavigationPropertyMapping.cs
- LinearKeyFrames.cs
- SubclassTypeValidator.cs
- ConsoleKeyInfo.cs
- SiteOfOriginPart.cs
- SqlError.cs
- DataServiceQuery.cs
- SimpleWorkerRequest.cs
- NotifyParentPropertyAttribute.cs
- XmlSerializationWriter.cs
- ImageBrush.cs
- FileAuthorizationModule.cs
- Calendar.cs
- CryptoStream.cs
- CacheMemory.cs
- ResourceDescriptionAttribute.cs
- RemoteWebConfigurationHostServer.cs
- StreamingContext.cs
- LowerCaseStringConverter.cs
- GACIdentityPermission.cs
- LoginUtil.cs
- FontStyleConverter.cs
- StdValidatorsAndConverters.cs
- COSERVERINFO.cs
- PropertyAccessVisitor.cs
- DictionarySurrogate.cs
- LoadedOrUnloadedOperation.cs
- DataGridViewRowsAddedEventArgs.cs
- CodeAccessPermission.cs
- PartitionResolver.cs
- MailWriter.cs
- RadioButton.cs
- Int32CAMarshaler.cs
- ComponentChangingEvent.cs
- GlyphCache.cs
- PagedDataSource.cs
- ProfilePropertyMetadata.cs
- BypassElementCollection.cs
- XamlFxTrace.cs
- RuntimeCompatibilityAttribute.cs
- ComponentDispatcher.cs
- WriteLineDesigner.xaml.cs
- CombinedGeometry.cs
- DigitShape.cs
- DesignerActionVerbList.cs
- SoapObjectReader.cs
- ImplicitInputBrush.cs
- CultureNotFoundException.cs
- ExpressionBindingCollection.cs
- DataIdProcessor.cs
- HitTestWithGeometryDrawingContextWalker.cs
- RawStylusActions.cs
- OleDbMetaDataFactory.cs
- TransformerTypeCollection.cs
- StrongTypingException.cs
- RadioButton.cs
- WorkflowValidationFailedException.cs
- RadioButtonBaseAdapter.cs
- InputGestureCollection.cs
- RegistryKey.cs
- DataGridViewCellErrorTextNeededEventArgs.cs
- EntityUtil.cs
- MouseActionValueSerializer.cs
- EntityDataSourceDataSelectionPanel.cs
- WebPartsPersonalization.cs
- DataRowChangeEvent.cs
- MailSettingsSection.cs
- MatrixIndependentAnimationStorage.cs
- ModelPropertyImpl.cs
- ToolBar.cs
- ResourceAttributes.cs
- BindingExpressionBase.cs
- StrokeNodeData.cs
- SpeechRecognizer.cs
- ExtendedProtectionPolicyTypeConverter.cs
- ArcSegment.cs
- ProtocolReflector.cs
- TemplateBindingExpressionConverter.cs
- SqlStatistics.cs
- XmlDataSourceView.cs
- WsdlBuildProvider.cs
- HttpSysSettings.cs
- ECDiffieHellmanCngPublicKey.cs
- TextSelectionHelper.cs
- DetailsViewUpdateEventArgs.cs