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
- RedistVersionInfo.cs
- DynamicILGenerator.cs
- DateBoldEvent.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- TreeBuilder.cs
- RuntimeHandles.cs
- FullTextState.cs
- ItemChangedEventArgs.cs
- OledbConnectionStringbuilder.cs
- ProfileProvider.cs
- TabControlAutomationPeer.cs
- List.cs
- VisualStyleInformation.cs
- ConstructorArgumentAttribute.cs
- BCLDebug.cs
- ReturnType.cs
- objectresult_tresulttype.cs
- HashCodeCombiner.cs
- SectionXmlInfo.cs
- RuntimeHelpers.cs
- DesignerView.xaml.cs
- GZipDecoder.cs
- AddInStore.cs
- FontFamilyConverter.cs
- WebDisplayNameAttribute.cs
- XmlSchemaSimpleTypeUnion.cs
- Style.cs
- BaseAddressElementCollection.cs
- X509ChainElement.cs
- CodeCastExpression.cs
- OrderedDictionaryStateHelper.cs
- ToolStripDropDownItem.cs
- PersonalizationEntry.cs
- AttachedPropertyMethodSelector.cs
- AspNetSynchronizationContext.cs
- MetadataArtifactLoader.cs
- TreeNodeStyle.cs
- NetworkInformationPermission.cs
- EasingKeyFrames.cs
- EntityDescriptor.cs
- StringFormat.cs
- CodeGroup.cs
- StyleCollectionEditor.cs
- DataFormats.cs
- SqlCacheDependencyDatabase.cs
- InternalCache.cs
- DependencyPropertyValueSerializer.cs
- BackgroundWorker.cs
- PipeStream.cs
- ToolStripDropTargetManager.cs
- PersonalizationState.cs
- TabItem.cs
- TableAutomationPeer.cs
- FormViewInsertedEventArgs.cs
- PackageRelationshipCollection.cs
- InvokeBase.cs
- SQLMembershipProvider.cs
- X509CertificateCollection.cs
- LocatorManager.cs
- BrowserDefinition.cs
- PageFunction.cs
- ParseChildrenAsPropertiesAttribute.cs
- DBConcurrencyException.cs
- VerifyHashRequest.cs
- EditorZone.cs
- SqlDesignerDataSourceView.cs
- __ConsoleStream.cs
- Scheduler.cs
- MaterialCollection.cs
- ExpressionBindings.cs
- ItemCollection.cs
- ViewService.cs
- Error.cs
- AccessedThroughPropertyAttribute.cs
- SessionPageStatePersister.cs
- RelatedCurrencyManager.cs
- TransformPatternIdentifiers.cs
- DataAccessor.cs
- Thumb.cs
- LazyTextWriterCreator.cs
- DesignerVerbToolStripMenuItem.cs
- SoapMessage.cs
- UInt64Converter.cs
- EpmHelper.cs
- PreservationFileReader.cs
- Menu.cs
- DataViewSettingCollection.cs
- ToolStripItemTextRenderEventArgs.cs
- SkewTransform.cs
- ConditionalAttribute.cs
- CompositeScriptReference.cs
- ObjectStorage.cs
- RangeValuePatternIdentifiers.cs
- IntSecurity.cs
- XmlSerializerAssemblyAttribute.cs
- ComponentManagerBroker.cs
- ListControl.cs
- DesignConnectionCollection.cs
- FramingChannels.cs
- XamlReader.cs