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
- XsdCachingReader.cs
- FixedSOMTableRow.cs
- RouteParametersHelper.cs
- XamlWrapperReaders.cs
- Reference.cs
- MultipleViewProviderWrapper.cs
- UrlPropertyAttribute.cs
- SourceFileBuildProvider.cs
- DefaultAssemblyResolver.cs
- XmlLanguageConverter.cs
- ProviderMetadataCachedInformation.cs
- BoundingRectTracker.cs
- StylusPointDescription.cs
- ReferenceService.cs
- WebScriptMetadataFormatter.cs
- FacetDescriptionElement.cs
- ListManagerBindingsCollection.cs
- LinkButton.cs
- SchemaNamespaceManager.cs
- XamlStream.cs
- RightsManagementEncryptedStream.cs
- WinEventTracker.cs
- CultureTable.cs
- InvariantComparer.cs
- AttributeUsageAttribute.cs
- DataGridAutoGeneratingColumnEventArgs.cs
- XmlSchemaImporter.cs
- _ChunkParse.cs
- Color.cs
- RegionInfo.cs
- PointConverter.cs
- DataBoundLiteralControl.cs
- Menu.cs
- BinaryCommonClasses.cs
- PublishLicense.cs
- PictureBox.cs
- XmlSchemaFacet.cs
- SchemaLookupTable.cs
- ColumnResizeUndoUnit.cs
- PageBuildProvider.cs
- FunctionUpdateCommand.cs
- AudioDeviceOut.cs
- PowerStatus.cs
- ViewStateException.cs
- IxmlLineInfo.cs
- SessionEndedEventArgs.cs
- MailMessageEventArgs.cs
- DrawingState.cs
- MethodSet.cs
- CopyOfAction.cs
- ValidatorCompatibilityHelper.cs
- ExecutionEngineException.cs
- XmlChoiceIdentifierAttribute.cs
- ScrollItemProviderWrapper.cs
- OutputCacheSettings.cs
- TextServicesManager.cs
- WebConfigurationManager.cs
- RegexCaptureCollection.cs
- BindingValueChangedEventArgs.cs
- WindowsToolbar.cs
- pingexception.cs
- TagNameToTypeMapper.cs
- MethodToken.cs
- GPStream.cs
- XPathQueryGenerator.cs
- InternalResources.cs
- DataStorage.cs
- SqlClientWrapperSmiStreamChars.cs
- StylusTip.cs
- XmlSchemaComplexContentRestriction.cs
- ReachPrintTicketSerializerAsync.cs
- SpellerStatusTable.cs
- COM2FontConverter.cs
- _FixedSizeReader.cs
- FixedLineResult.cs
- RegistrationServices.cs
- CommaDelimitedStringAttributeCollectionConverter.cs
- DataControlFieldHeaderCell.cs
- SByteStorage.cs
- BaseCodeDomTreeGenerator.cs
- KeyTime.cs
- ReferencedCollectionType.cs
- ActionFrame.cs
- HttpListenerPrefixCollection.cs
- MarkerProperties.cs
- Page.cs
- EnterpriseServicesHelper.cs
- TableChangeProcessor.cs
- CodeTypeDeclaration.cs
- DigestComparer.cs
- WebAdminConfigurationHelper.cs
- SmiEventSink_Default.cs
- DBBindings.cs
- AuthStoreRoleProvider.cs
- FormattedText.cs
- Visual3DCollection.cs
- OrderedParallelQuery.cs
- ResourcePart.cs
- SerialStream.cs
- SingleConverter.cs