Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / Misc / GDI / WindowsSolidBrush.cs / 1 / WindowsSolidBrush.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- #if WINFORMS_NAMESPACE namespace System.Windows.Forms.Internal #elif DRAWING_NAMESPACE namespace System.Drawing.Internal #else namespace System.Experimental.Gdi #endif { using System; using System.Internal; using System.Runtime.InteropServices; using System.ComponentModel; using System.Diagnostics; using System.Drawing; using System.Globalization; #if WINFORMS_PUBLIC_GRAPHICS_LIBRARY public #else internal #endif sealed class WindowsSolidBrush : WindowsBrush { protected override void CreateBrush() { IntPtr nativeHandle = IntSafeNativeMethods.CreateSolidBrush(ColorTranslator.ToWin32( this.Color)); if(nativeHandle == IntPtr.Zero) // Don't use Debug.Assert, DbgUtil.GetLastErrorStr would always be evaluated. { Debug.Fail("CreateSolidBrush failed : " + DbgUtil.GetLastErrorStr()); } this.NativeHandle = nativeHandle; // sets the handle value in the base class. } public WindowsSolidBrush(DeviceContext dc) : base(dc) { // CreateBrush() on demand. } public WindowsSolidBrush(DeviceContext dc, Color color) : base( dc, color ) { // CreateBrush() on demand. } public override object Clone() { return new WindowsSolidBrush(this.DC, this.Color); } public override string ToString() { return String.Format( CultureInfo.InvariantCulture, "{0}: Color={1}", this.GetType().Name, this.Color ); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- #if WINFORMS_NAMESPACE namespace System.Windows.Forms.Internal #elif DRAWING_NAMESPACE namespace System.Drawing.Internal #else namespace System.Experimental.Gdi #endif { using System; using System.Internal; using System.Runtime.InteropServices; using System.ComponentModel; using System.Diagnostics; using System.Drawing; using System.Globalization; #if WINFORMS_PUBLIC_GRAPHICS_LIBRARY public #else internal #endif sealed class WindowsSolidBrush : WindowsBrush { protected override void CreateBrush() { IntPtr nativeHandle = IntSafeNativeMethods.CreateSolidBrush(ColorTranslator.ToWin32( this.Color)); if(nativeHandle == IntPtr.Zero) // Don't use Debug.Assert, DbgUtil.GetLastErrorStr would always be evaluated. { Debug.Fail("CreateSolidBrush failed : " + DbgUtil.GetLastErrorStr()); } this.NativeHandle = nativeHandle; // sets the handle value in the base class. } public WindowsSolidBrush(DeviceContext dc) : base(dc) { // CreateBrush() on demand. } public WindowsSolidBrush(DeviceContext dc, Color color) : base( dc, color ) { // CreateBrush() on demand. } public override object Clone() { return new WindowsSolidBrush(this.DC, this.Color); } public override string ToString() { return String.Format( CultureInfo.InvariantCulture, "{0}: Color={1}", this.GetType().Name, this.Color ); } } } // 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
- SelectionService.cs
- XmlExtensionFunction.cs
- UnsafeNativeMethods.cs
- PagesSection.cs
- TextContainer.cs
- ImageAttributes.cs
- ErrorWrapper.cs
- DataGridCellsPanel.cs
- SubordinateTransaction.cs
- HtmlInputControl.cs
- CompilerParameters.cs
- GetCertificateRequest.cs
- OutputCacheModule.cs
- Claim.cs
- CreateUserErrorEventArgs.cs
- MSG.cs
- EndOfStreamException.cs
- HandleRef.cs
- CounterCreationDataConverter.cs
- UnmanagedMemoryStream.cs
- DataGridViewColumnDesigner.cs
- LockCookie.cs
- SqlRowUpdatedEvent.cs
- WaitHandle.cs
- DefaultValidator.cs
- RowUpdatingEventArgs.cs
- OptimizedTemplateContent.cs
- RegexRunnerFactory.cs
- SqlExpressionNullability.cs
- ListViewItemSelectionChangedEvent.cs
- TreeViewHitTestInfo.cs
- XmlDataCollection.cs
- NodeCounter.cs
- Matrix3DStack.cs
- ColorIndependentAnimationStorage.cs
- EmptyImpersonationContext.cs
- ReceiveSecurityHeaderEntry.cs
- ResourceDefaultValueAttribute.cs
- HtmlPhoneCallAdapter.cs
- DesignerActionListCollection.cs
- SiteMapNodeCollection.cs
- PrivateUnsafeNativeCompoundFileMethods.cs
- DirtyTextRange.cs
- ListView.cs
- figurelength.cs
- CellIdBoolean.cs
- ListViewInsertionMark.cs
- PrintingPermissionAttribute.cs
- SqlUtil.cs
- RegexBoyerMoore.cs
- Message.cs
- WindowsMenu.cs
- ListBase.cs
- TreeView.cs
- ToolStripAdornerWindowService.cs
- WindowsSysHeader.cs
- HttpResponseWrapper.cs
- AddressHeaderCollectionElement.cs
- SoapWriter.cs
- CheckBoxDesigner.cs
- SecurityAlgorithmSuiteConverter.cs
- EntityDesignerUtils.cs
- DataTableMapping.cs
- SecurityException.cs
- SwitchElementsCollection.cs
- IPEndPoint.cs
- BitmapFrameEncode.cs
- JoinQueryOperator.cs
- SHA256Managed.cs
- Property.cs
- Thickness.cs
- SiteMapDataSourceView.cs
- RoutedCommand.cs
- StorageRoot.cs
- HandlerBase.cs
- RegexWorker.cs
- CompiledScopeCriteria.cs
- FixedHyperLink.cs
- UrlPropertyAttribute.cs
- SystemColors.cs
- Panel.cs
- SiteMapDataSourceDesigner.cs
- HtmlFormWrapper.cs
- ProvideValueServiceProvider.cs
- TextRenderer.cs
- IISMapPath.cs
- PropertyRecord.cs
- SmtpDigestAuthenticationModule.cs
- ScopelessEnumAttribute.cs
- TdsValueSetter.cs
- SecurityCriticalDataForSet.cs
- XmlDictionaryReaderQuotas.cs
- CodeConstructor.cs
- ServicesUtilities.cs
- Attributes.cs
- URI.cs
- GetIndexBinder.cs
- ListViewDesigner.cs
- CalendarAutoFormatDialog.cs
- QuaternionAnimation.cs