Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- LogAppendAsyncResult.cs
- XmlIlGenerator.cs
- FunctionCommandText.cs
- CodeNamespaceImport.cs
- MouseEvent.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- GridItemPattern.cs
- ChtmlTextWriter.cs
- URLMembershipCondition.cs
- SoapAttributeAttribute.cs
- LambdaCompiler.Logical.cs
- CorrelationToken.cs
- ApplicationSettingsBase.cs
- ProcessInputEventArgs.cs
- NumberFunctions.cs
- DiscoveryDocumentSerializer.cs
- BitmapPalette.cs
- ObfuscationAttribute.cs
- TextFragmentEngine.cs
- ArgIterator.cs
- AgileSafeNativeMemoryHandle.cs
- RefreshPropertiesAttribute.cs
- CancellationTokenSource.cs
- StandardMenuStripVerb.cs
- PersonalizationStateInfoCollection.cs
- RadioButtonFlatAdapter.cs
- TrackingMemoryStream.cs
- PathFigureCollection.cs
- ProviderMetadataCachedInformation.cs
- EntityDataSourceWrapperCollection.cs
- ControlBuilderAttribute.cs
- SynchronizedPool.cs
- SimpleApplicationHost.cs
- ToolboxItemCollection.cs
- DelegatingTypeDescriptionProvider.cs
- SizeAnimationClockResource.cs
- KeyValueSerializer.cs
- ValidationService.cs
- TypeSystem.cs
- ConfigurationPropertyCollection.cs
- Matrix3DStack.cs
- TextServicesCompartmentContext.cs
- CompensationHandlingFilter.cs
- PolyLineSegmentFigureLogic.cs
- MessageQueueInstaller.cs
- InfoCardCryptoHelper.cs
- TextMessageEncodingElement.cs
- IsolationInterop.cs
- GenerateHelper.cs
- TransportDefaults.cs
- PlainXmlDeserializer.cs
- Attachment.cs
- WindowsListViewItemCheckBox.cs
- CodeTypeMember.cs
- ActionMessageFilter.cs
- DetailsViewDeletedEventArgs.cs
- MenuAutomationPeer.cs
- SQLSingleStorage.cs
- ResourceReferenceExpression.cs
- DbConnectionStringBuilder.cs
- ProcessHostServerConfig.cs
- ListenerHandler.cs
- RenderData.cs
- FormatConvertedBitmap.cs
- Privilege.cs
- X509SecurityTokenProvider.cs
- Int64Animation.cs
- SafeCryptoHandles.cs
- TypeToTreeConverter.cs
- QuotedPrintableStream.cs
- sqlcontext.cs
- SqlUtil.cs
- RequestCachePolicy.cs
- _Connection.cs
- EntityDataSource.cs
- ProfilePropertyMetadata.cs
- AnimationLayer.cs
- MimePart.cs
- DataGridViewComboBoxEditingControl.cs
- DataObjectPastingEventArgs.cs
- IndentTextWriter.cs
- DataGridRowDetailsEventArgs.cs
- altserialization.cs
- sitestring.cs
- CollectionViewSource.cs
- TableProviderWrapper.cs
- LabelLiteral.cs
- KeyNotFoundException.cs
- Baml2006KnownTypes.cs
- OpacityConverter.cs
- ServiceObjectContainer.cs
- UnsafeNativeMethods.cs
- X509PeerCertificateAuthenticationElement.cs
- shaper.cs
- SecurityHelper.cs
- SqlNamer.cs
- EntityTypeBase.cs
- StreamingContext.cs
- ToolstripProfessionalRenderer.cs
- mediapermission.cs