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
- AuthenticationServiceManager.cs
- HtmlAnchor.cs
- OledbConnectionStringbuilder.cs
- TaskFormBase.cs
- X509Certificate2.cs
- XmlSchemaExternal.cs
- ToolStripItemDataObject.cs
- XmlLanguageConverter.cs
- InternalConfigEventArgs.cs
- SchemaCollectionPreprocessor.cs
- Evaluator.cs
- StructuralObject.cs
- XmlILAnnotation.cs
- StreamReader.cs
- WCFModelStrings.Designer.cs
- AutoCompleteStringCollection.cs
- ApplicationHost.cs
- RectConverter.cs
- CorePropertiesFilter.cs
- DataBindingHandlerAttribute.cs
- AspCompat.cs
- RecognitionEventArgs.cs
- MethodMessage.cs
- Ref.cs
- DateTimeConverter2.cs
- ConfigurationPropertyCollection.cs
- ChangeInterceptorAttribute.cs
- HttpContext.cs
- PresentationAppDomainManager.cs
- IdentityReference.cs
- EastAsianLunisolarCalendar.cs
- XmlDataProvider.cs
- ProcessHostFactoryHelper.cs
- InputProcessorProfiles.cs
- MSAANativeProvider.cs
- MimeXmlReflector.cs
- Int32CAMarshaler.cs
- DataRowExtensions.cs
- PageAdapter.cs
- StructuredTypeInfo.cs
- smtppermission.cs
- PathSegmentCollection.cs
- SafeProcessHandle.cs
- WebPartConnectVerb.cs
- ExpressionConverter.cs
- AtomContentProperty.cs
- SoapServerMethod.cs
- XamlStyleSerializer.cs
- ToolStripDropDownMenu.cs
- Encoding.cs
- DetailsViewModeEventArgs.cs
- Enlistment.cs
- SignedInfo.cs
- ReadOnlyPropertyMetadata.cs
- TableLayoutSettingsTypeConverter.cs
- ProxyGenerationError.cs
- RegionInfo.cs
- ContentHostHelper.cs
- Privilege.cs
- TdsParserStateObject.cs
- FileDialogCustomPlace.cs
- XmlnsDictionary.cs
- DeviceFilterEditorDialog.cs
- PositiveTimeSpanValidator.cs
- WebPartHeaderCloseVerb.cs
- StreamGeometry.cs
- ProjectionCamera.cs
- EventKeyword.cs
- EntityDataSource.cs
- QueryResultOp.cs
- MatrixAnimationUsingKeyFrames.cs
- Bind.cs
- TextBox.cs
- Selector.cs
- DataServiceHostFactory.cs
- TemplateAction.cs
- FormsAuthenticationConfiguration.cs
- RenderDataDrawingContext.cs
- SoapEnumAttribute.cs
- IPAddress.cs
- MetadataUtilsSmi.cs
- OracleBFile.cs
- ConfigXmlSignificantWhitespace.cs
- _CommandStream.cs
- XslTransform.cs
- CommandBindingCollection.cs
- InertiaTranslationBehavior.cs
- AdvancedBindingEditor.cs
- Hashtable.cs
- UTF8Encoding.cs
- SqlUtils.cs
- SyndicationSerializer.cs
- ObjectDataSourceMethodEventArgs.cs
- UserControl.cs
- Select.cs
- ToolStripContentPanelDesigner.cs
- MiniParameterInfo.cs
- ProviderIncompatibleException.cs
- Wildcard.cs
- ToolStripPanelRow.cs