Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / CommonUI / System / Drawing / Advanced / HatchBrush.cs / 1 / 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; /** * 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 */ ////// /// 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. /// /// /// 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); SetNativeBrush(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." ); SetNativeBrush( nativeBrush ); } ////// /// Creates an exact copy of this 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; /** * 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 */ ////// /// 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. /// /// /// 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); SetNativeBrush(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." ); SetNativeBrush( nativeBrush ); } ////// /// Creates an exact copy of this 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
- PartialArray.cs
- DiagnosticsConfigurationHandler.cs
- XmlNodeChangedEventManager.cs
- SafeNativeMethodsMilCoreApi.cs
- milexports.cs
- Int16Converter.cs
- ImmutableCollection.cs
- ToolStripButton.cs
- SafeTokenHandle.cs
- JournalEntryStack.cs
- OdbcConnection.cs
- DiffuseMaterial.cs
- WebPartZoneCollection.cs
- TimeoutTimer.cs
- RsaSecurityKey.cs
- CalendarButtonAutomationPeer.cs
- RepeatBehaviorConverter.cs
- ColumnTypeConverter.cs
- MultiView.cs
- BitmapPalette.cs
- XmlSerializerAssemblyAttribute.cs
- ElementUtil.cs
- XmlSchemaObjectCollection.cs
- BindingSource.cs
- ButtonChrome.cs
- UserControl.cs
- LocalIdCollection.cs
- QilBinary.cs
- ObjectConverter.cs
- LicenseManager.cs
- TemplateNameScope.cs
- TypefaceMap.cs
- RefreshPropertiesAttribute.cs
- ContainerControl.cs
- XmlValueConverter.cs
- SqlConnectionHelper.cs
- DiagnosticStrings.cs
- PipeException.cs
- JpegBitmapDecoder.cs
- ConfigurationManager.cs
- ConfigurationStrings.cs
- ClientWindowsAuthenticationMembershipProvider.cs
- XPathNodeList.cs
- DataGridViewLinkCell.cs
- InputLanguageSource.cs
- MeasurementDCInfo.cs
- SafeNativeMethodsOther.cs
- DispatcherTimer.cs
- _ScatterGatherBuffers.cs
- BufferedReceiveManager.cs
- Int64KeyFrameCollection.cs
- DataServiceRequestException.cs
- Rectangle.cs
- SelectionHighlightInfo.cs
- FrameSecurityDescriptor.cs
- Viewport3DAutomationPeer.cs
- XPathPatternBuilder.cs
- SafeUserTokenHandle.cs
- Screen.cs
- OleServicesContext.cs
- UnitySerializationHolder.cs
- ParameterBuilder.cs
- HtmlInputText.cs
- BaseCollection.cs
- SplineQuaternionKeyFrame.cs
- ReferentialConstraint.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- SettingsPropertyIsReadOnlyException.cs
- ActivityPreviewDesigner.cs
- QilBinary.cs
- OracleParameterCollection.cs
- SystemWebExtensionsSectionGroup.cs
- SecureStringHasher.cs
- PrivilegeNotHeldException.cs
- ProfileService.cs
- DataListItemEventArgs.cs
- EastAsianLunisolarCalendar.cs
- PackUriHelper.cs
- DataGridViewCellStyleChangedEventArgs.cs
- DataGridColumn.cs
- HtmlTableRow.cs
- FlowDocumentPaginator.cs
- MemoryRecordBuffer.cs
- WinEventQueueItem.cs
- XPathDocumentBuilder.cs
- ProbeMatches11.cs
- RuleInfoComparer.cs
- Pens.cs
- BitmapEffectInput.cs
- DataGridCellClipboardEventArgs.cs
- SchemaElementLookUpTable.cs
- ConstraintManager.cs
- ProfileElement.cs
- RepeaterItemEventArgs.cs
- IxmlLineInfo.cs
- SqlXml.cs
- ButtonBase.cs
- ObjectView.cs
- ApplicationContext.cs
- HttpListenerContext.cs