Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Misc / GDI / WindowsSolidBrush.cs / 1305376 / WindowsSolidBrush.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- #if [....]_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; using System.Runtime.Versioning; #if [....]_PUBLIC_GRAPHICS_LIBRARY public #else internal #endif sealed class WindowsSolidBrush : WindowsBrush { [ResourceExposure(ResourceScope.Process)] [ResourceConsumption(ResourceScope.Process)] 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. } [ResourceExposure(ResourceScope.Process)] [ResourceConsumption(ResourceScope.Process)] public WindowsSolidBrush(DeviceContext dc) : base(dc) { // CreateBrush() on demand. } [ResourceExposure(ResourceScope.Process)] [ResourceConsumption(ResourceScope.Process)] public WindowsSolidBrush(DeviceContext dc, Color color) : base( dc, color ) { // CreateBrush() on demand. } [ResourceExposure(ResourceScope.Process)] [ResourceConsumption(ResourceScope.Process)] 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 [....]_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; using System.Runtime.Versioning; #if [....]_PUBLIC_GRAPHICS_LIBRARY public #else internal #endif sealed class WindowsSolidBrush : WindowsBrush { [ResourceExposure(ResourceScope.Process)] [ResourceConsumption(ResourceScope.Process)] 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. } [ResourceExposure(ResourceScope.Process)] [ResourceConsumption(ResourceScope.Process)] public WindowsSolidBrush(DeviceContext dc) : base(dc) { // CreateBrush() on demand. } [ResourceExposure(ResourceScope.Process)] [ResourceConsumption(ResourceScope.Process)] public WindowsSolidBrush(DeviceContext dc, Color color) : base( dc, color ) { // CreateBrush() on demand. } [ResourceExposure(ResourceScope.Process)] [ResourceConsumption(ResourceScope.Process)] 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
- XmlComment.cs
- QilPatternFactory.cs
- ByteStreamMessageEncoder.cs
- EventMemberCodeDomSerializer.cs
- AssemblyResourceLoader.cs
- WmlObjectListAdapter.cs
- MaterialGroup.cs
- AmbientProperties.cs
- PngBitmapDecoder.cs
- SQLDateTimeStorage.cs
- thaishape.cs
- smtpconnection.cs
- WebPartsPersonalization.cs
- AccessDataSourceDesigner.cs
- SpellerHighlightLayer.cs
- FileUpload.cs
- SHA384.cs
- TrackBarRenderer.cs
- ClosureBinding.cs
- arabicshape.cs
- TextBoxLine.cs
- ChtmlTextWriter.cs
- PassportAuthenticationEventArgs.cs
- Timeline.cs
- HttpResponseBase.cs
- PingReply.cs
- ButtonFieldBase.cs
- CheckBoxList.cs
- base64Transforms.cs
- DataBindingExpressionBuilder.cs
- CodeStatementCollection.cs
- AllowedAudienceUriElement.cs
- AppearanceEditorPart.cs
- SecurityKeyUsage.cs
- AllMembershipCondition.cs
- DataServiceCollectionOfT.cs
- PopOutPanel.cs
- ResourceDefaultValueAttribute.cs
- BuildProviderUtils.cs
- AuthorizationContext.cs
- TextBoxBaseDesigner.cs
- XmlProcessingInstruction.cs
- CodeArgumentReferenceExpression.cs
- InvalidComObjectException.cs
- ObjectDataSource.cs
- BuildProviderCollection.cs
- HandlerFactoryCache.cs
- unsafenativemethodstextservices.cs
- DataTableCollection.cs
- NegatedConstant.cs
- PropertyGroupDescription.cs
- BufferCache.cs
- LoadRetryConstantStrategy.cs
- InputGestureCollection.cs
- FontCollection.cs
- RayMeshGeometry3DHitTestResult.cs
- HwndSourceKeyboardInputSite.cs
- Variable.cs
- DbConnectionPoolIdentity.cs
- NumberFunctions.cs
- StylusPointCollection.cs
- DiffuseMaterial.cs
- propertyentry.cs
- SplineKeyFrames.cs
- PropertyCondition.cs
- PageParser.cs
- ReadOnlyDataSource.cs
- ToolStripAdornerWindowService.cs
- BevelBitmapEffect.cs
- ContactManager.cs
- GenericEnumerator.cs
- SQLInt64.cs
- ServiceModelConfigurationSection.cs
- MSHTMLHostUtil.cs
- XpsS0ValidatingLoader.cs
- WorkflowRuntimeSection.cs
- SqlTriggerContext.cs
- Executor.cs
- xmlglyphRunInfo.cs
- Emitter.cs
- EntityWrapper.cs
- CodeAttributeArgumentCollection.cs
- ExceptionUtility.cs
- ItemContainerGenerator.cs
- ObjectQuery.cs
- Stack.cs
- Parser.cs
- NativeMethods.cs
- CommandManager.cs
- CompressEmulationStream.cs
- SystemParameters.cs
- ZoneIdentityPermission.cs
- ToolStripScrollButton.cs
- ControlHelper.cs
- ContextProperty.cs
- ApplicationContext.cs
- ObjectStateEntryBaseUpdatableDataRecord.cs
- DecodeHelper.cs
- SimpleBitVector32.cs
- ListControlStringCollectionEditor.cs