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
- EnumType.cs
- Single.cs
- CodeAttachEventStatement.cs
- CodeArrayIndexerExpression.cs
- PropertyChangeTracker.cs
- TableLayoutSettingsTypeConverter.cs
- WebContext.cs
- UriScheme.cs
- ValueUtilsSmi.cs
- UserPreferenceChangedEventArgs.cs
- AttributeQuery.cs
- OleAutBinder.cs
- PersonalizationProviderCollection.cs
- LocatorBase.cs
- CompoundFileReference.cs
- DeclaredTypeElementCollection.cs
- MembershipSection.cs
- HttpCacheParams.cs
- MsmqAppDomainProtocolHandler.cs
- TypeUtil.cs
- HashHelper.cs
- IntegerValidator.cs
- StringUtil.cs
- Listbox.cs
- DataTableMapping.cs
- MTConfigUtil.cs
- Transform.cs
- PersonalizablePropertyEntry.cs
- UInt32.cs
- SectionVisual.cs
- AppSettingsReader.cs
- EdmComplexPropertyAttribute.cs
- NestedContainer.cs
- StrokeNodeOperations.cs
- DiffuseMaterial.cs
- SecureEnvironment.cs
- UnsafeNativeMethodsCLR.cs
- HTMLTextWriter.cs
- UnsafeNativeMethods.cs
- NotifyIcon.cs
- CodeTypeMember.cs
- BitmapData.cs
- GestureRecognizer.cs
- RuntimeWrappedException.cs
- ClassImporter.cs
- parserscommon.cs
- DispatchRuntime.cs
- DataGridViewAccessibleObject.cs
- ToolboxSnapDragDropEventArgs.cs
- ApplicationServicesHostFactory.cs
- BevelBitmapEffect.cs
- Zone.cs
- ISAPIWorkerRequest.cs
- StringSource.cs
- FrameworkContextData.cs
- ToolStripDropDownMenu.cs
- CommentEmitter.cs
- ConfigDefinitionUpdates.cs
- DeploymentExceptionMapper.cs
- DataSourceCache.cs
- TypeForwardedToAttribute.cs
- ReadOnlyDataSource.cs
- DefaultShape.cs
- ProjectionCamera.cs
- ManipulationStartedEventArgs.cs
- HScrollProperties.cs
- ArcSegment.cs
- ValidationSummary.cs
- DecimalConstantAttribute.cs
- FlowDocumentView.cs
- ValueTable.cs
- ZeroOpNode.cs
- SspiNegotiationTokenAuthenticatorState.cs
- DesignerLoader.cs
- VScrollProperties.cs
- StringConcat.cs
- VectorCollectionConverter.cs
- TextTreeText.cs
- DataProviderNameConverter.cs
- StylusPointPropertyInfoDefaults.cs
- DataGridViewImageCell.cs
- NTAccount.cs
- Win32Interop.cs
- TemplateBamlTreeBuilder.cs
- MetadataCacheItem.cs
- CompareValidator.cs
- XmlStringTable.cs
- ToolStripContentPanelRenderEventArgs.cs
- QueryCacheEntry.cs
- XhtmlBasicValidationSummaryAdapter.cs
- KnownBoxes.cs
- EntityDataSourceEntityTypeFilterItem.cs
- TableLayoutPanelCodeDomSerializer.cs
- SelectionRangeConverter.cs
- XmlEncoding.cs
- ForceCopyBuildProvider.cs
- ConnectionConsumerAttribute.cs
- Quaternion.cs
- RightsManagementPermission.cs
- StringHelper.cs