Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CommonUI / System / Drawing / Advanced / HatchBrush.cs / 1305376 / HatchBrush.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Drawing.Drawing2D { using System.Runtime.InteropServices; using System.Diagnostics; using System; using System.Drawing; using System.ComponentModel; using Microsoft.Win32; using System.Drawing.Internal; using System.Runtime.Versioning; /** * Represent a HatchBrush brush object */ ////// /// Defines a rectangular brush with a hatch /// style, a foreground color, and a background color. /// public sealed class HatchBrush : Brush { /** * Create a new hatch brush object */ ////// /// [ResourceExposure(ResourceScope.Process)] [ResourceConsumption(ResourceScope.Process)] public HatchBrush(HatchStyle hatchstyle, Color foreColor) : this(hatchstyle, foreColor, Color.FromArgb( (int) unchecked( (int) 0xff000000) ) ) { } ////// Initializes a new instance of the ///class with the specified and foreground color. /// /// /// [ResourceExposure(ResourceScope.Process)] [ResourceConsumption(ResourceScope.Process)] public HatchBrush(HatchStyle hatchstyle, Color foreColor, Color backColor) { IntPtr brush = IntPtr.Zero; int status = SafeNativeMethods.Gdip.GdipCreateHatchBrush((int) hatchstyle, foreColor.ToArgb(), backColor.ToArgb(), out brush); if (status != SafeNativeMethods.Gdip.Ok) throw SafeNativeMethods.Gdip.StatusException(status); SetNativeBrushInternal(brush); } ////// Initializes a new instance of the ///class with the specified , /// foreground color, and background color. /// /// Constructor to initialize this object from a GDI+ native reference. /// internal HatchBrush(IntPtr nativeBrush ) { Debug.Assert( nativeBrush != IntPtr.Zero, "Initializing native brush with null." ); SetNativeBrushInternal( nativeBrush ); } ////// /// Creates an exact copy of this [ResourceExposure(ResourceScope.Process)] [ResourceConsumption(ResourceScope.Process)] public override object Clone() { IntPtr cloneBrush = IntPtr.Zero; int status = SafeNativeMethods.Gdip.GdipCloneBrush(new HandleRef(this, this.NativeBrush), out cloneBrush); if (status != SafeNativeMethods.Gdip.Ok) throw SafeNativeMethods.Gdip.StatusException(status); return new HatchBrush(cloneBrush); } /** * Get hatch brush object attributes */ ///. /// /// /// Gets the hatch style of this public HatchStyle HatchStyle { get { int hatchStyle = 0; int status = SafeNativeMethods.Gdip.GdipGetHatchStyle(new HandleRef(this, this.NativeBrush), out hatchStyle); if (status != SafeNativeMethods.Gdip.Ok) throw SafeNativeMethods.Gdip.StatusException(status); return (HatchStyle) hatchStyle; } } ///. /// /// /// Gets the color of hatch lines drawn by this /// public Color ForegroundColor { get { int forecol; int status = SafeNativeMethods.Gdip.GdipGetHatchForegroundColor(new HandleRef(this, this.NativeBrush), out forecol); if (status != SafeNativeMethods.Gdip.Ok) throw SafeNativeMethods.Gdip.StatusException(status); return Color.FromArgb(forecol); } } ///. /// /// /// public Color BackgroundColor { get { int backcol; int status = SafeNativeMethods.Gdip.GdipGetHatchBackgroundColor(new HandleRef(this, this.NativeBrush), out backcol); if (status != SafeNativeMethods.Gdip.Ok) throw SafeNativeMethods.Gdip.StatusException(status); return Color.FromArgb(backcol); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ ///// Gets the color of spaces between the hatch /// lines drawn by this ///. /// // Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Drawing.Drawing2D { using System.Runtime.InteropServices; using System.Diagnostics; using System; using System.Drawing; using System.ComponentModel; using Microsoft.Win32; using System.Drawing.Internal; using System.Runtime.Versioning; /** * Represent a HatchBrush brush object */ ////// /// Defines a rectangular brush with a hatch /// style, a foreground color, and a background color. /// public sealed class HatchBrush : Brush { /** * Create a new hatch brush object */ ////// /// [ResourceExposure(ResourceScope.Process)] [ResourceConsumption(ResourceScope.Process)] public HatchBrush(HatchStyle hatchstyle, Color foreColor) : this(hatchstyle, foreColor, Color.FromArgb( (int) unchecked( (int) 0xff000000) ) ) { } ////// Initializes a new instance of the ///class with the specified and foreground color. /// /// /// [ResourceExposure(ResourceScope.Process)] [ResourceConsumption(ResourceScope.Process)] public HatchBrush(HatchStyle hatchstyle, Color foreColor, Color backColor) { IntPtr brush = IntPtr.Zero; int status = SafeNativeMethods.Gdip.GdipCreateHatchBrush((int) hatchstyle, foreColor.ToArgb(), backColor.ToArgb(), out brush); if (status != SafeNativeMethods.Gdip.Ok) throw SafeNativeMethods.Gdip.StatusException(status); SetNativeBrushInternal(brush); } ////// Initializes a new instance of the ///class with the specified , /// foreground color, and background color. /// /// Constructor to initialize this object from a GDI+ native reference. /// internal HatchBrush(IntPtr nativeBrush ) { Debug.Assert( nativeBrush != IntPtr.Zero, "Initializing native brush with null." ); SetNativeBrushInternal( nativeBrush ); } ////// /// Creates an exact copy of this [ResourceExposure(ResourceScope.Process)] [ResourceConsumption(ResourceScope.Process)] public override object Clone() { IntPtr cloneBrush = IntPtr.Zero; int status = SafeNativeMethods.Gdip.GdipCloneBrush(new HandleRef(this, this.NativeBrush), out cloneBrush); if (status != SafeNativeMethods.Gdip.Ok) throw SafeNativeMethods.Gdip.StatusException(status); return new HatchBrush(cloneBrush); } /** * Get hatch brush object attributes */ ///. /// /// /// Gets the hatch style of this public HatchStyle HatchStyle { get { int hatchStyle = 0; int status = SafeNativeMethods.Gdip.GdipGetHatchStyle(new HandleRef(this, this.NativeBrush), out hatchStyle); if (status != SafeNativeMethods.Gdip.Ok) throw SafeNativeMethods.Gdip.StatusException(status); return (HatchStyle) hatchStyle; } } ///. /// /// /// Gets the color of hatch lines drawn by this /// public Color ForegroundColor { get { int forecol; int status = SafeNativeMethods.Gdip.GdipGetHatchForegroundColor(new HandleRef(this, this.NativeBrush), out forecol); if (status != SafeNativeMethods.Gdip.Ok) throw SafeNativeMethods.Gdip.StatusException(status); return Color.FromArgb(forecol); } } ///. /// /// /// public Color BackgroundColor { get { int backcol; int status = SafeNativeMethods.Gdip.GdipGetHatchBackgroundColor(new HandleRef(this, this.NativeBrush), out backcol); if (status != SafeNativeMethods.Gdip.Ok) throw SafeNativeMethods.Gdip.StatusException(status); return Color.FromArgb(backcol); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007./// Gets the color of spaces between the hatch /// lines drawn by this ///. ///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SqlLiftWhereClauses.cs
- Container.cs
- DesignerTextViewAdapter.cs
- StreamMarshaler.cs
- UserControlParser.cs
- ButtonChrome.cs
- Utils.cs
- DoubleLink.cs
- srgsitem.cs
- MultipartIdentifier.cs
- DockPatternIdentifiers.cs
- WebContext.cs
- HTTP_SERVICE_CONFIG_URLACL_KEY.cs
- ButtonBase.cs
- SingleAnimationBase.cs
- X509CertificateChain.cs
- CallbackHandler.cs
- SeverityFilter.cs
- FixUpCollection.cs
- XhtmlTextWriter.cs
- ProfileModule.cs
- BoolExpression.cs
- CryptoConfig.cs
- contentDescriptor.cs
- VersionPair.cs
- FragmentQuery.cs
- DataSourceDescriptorCollection.cs
- ToolStripItemTextRenderEventArgs.cs
- ProfessionalColors.cs
- ListCollectionView.cs
- SingleObjectCollection.cs
- CodeNamespaceImport.cs
- DocumentManager.cs
- GenericUriParser.cs
- MergeFailedEvent.cs
- Win32KeyboardDevice.cs
- SuppressMergeCheckAttribute.cs
- ClientBase.cs
- SettingsPropertyWrongTypeException.cs
- QualifiedCellIdBoolean.cs
- WebServiceClientProxyGenerator.cs
- FontSourceCollection.cs
- NativeMethods.cs
- SecurityKeyIdentifier.cs
- TempFiles.cs
- LinqDataSourceStatusEventArgs.cs
- ChameleonKey.cs
- ToolboxDataAttribute.cs
- DSACryptoServiceProvider.cs
- AssemblyAssociatedContentFileAttribute.cs
- RedistVersionInfo.cs
- EditorPart.cs
- DataGridDesigner.cs
- DebuggerAttributes.cs
- BamlResourceContent.cs
- ChannelBuilder.cs
- ParameterElementCollection.cs
- InternalsVisibleToAttribute.cs
- DescendantOverDescendantQuery.cs
- QuaternionRotation3D.cs
- SqlTriggerAttribute.cs
- GeneratedContractType.cs
- ReferencedType.cs
- RuntimeConfigurationRecord.cs
- MissingSatelliteAssemblyException.cs
- OutputCacheProfileCollection.cs
- TrackingStringDictionary.cs
- ValueTypeFixupInfo.cs
- TableCellAutomationPeer.cs
- WebServiceHost.cs
- UnionExpr.cs
- EntityContainer.cs
- FormsAuthentication.cs
- KerberosTokenFactoryCredential.cs
- PackageFilter.cs
- ConstrainedDataObject.cs
- TransformedBitmap.cs
- NumberSubstitution.cs
- MSHTMLHost.cs
- AdjustableArrowCap.cs
- ZoneLinkButton.cs
- LogEntrySerializer.cs
- ProjectionCamera.cs
- Publisher.cs
- ReferentialConstraint.cs
- UnsafeNetInfoNativeMethods.cs
- DeviceFiltersSection.cs
- Button.cs
- FlowLayout.cs
- Hash.cs
- ZipIOLocalFileDataDescriptor.cs
- Highlights.cs
- TdsParameterSetter.cs
- AssemblyAttributes.cs
- LazyTextWriterCreator.cs
- KernelTypeValidation.cs
- DesignerSerializationOptionsAttribute.cs
- FSWPathEditor.cs
- DispatcherObject.cs
- EntityDataSourceView.cs