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
- ByteKeyFrameCollection.cs
- CodeDomConfigurationHandler.cs
- LinkLabelLinkClickedEvent.cs
- OperationParameterInfoCollection.cs
- RbTree.cs
- ListSortDescription.cs
- TimeStampChecker.cs
- Registry.cs
- SqlUtils.cs
- SHA384.cs
- CRYPTPROTECT_PROMPTSTRUCT.cs
- MimeTypeMapper.cs
- WebProxyScriptElement.cs
- FatalException.cs
- PartialToken.cs
- CqlParser.cs
- FixedDocumentPaginator.cs
- ToolStripItemDesigner.cs
- HatchBrush.cs
- DataGridViewRowCancelEventArgs.cs
- XmlDesignerDataSourceView.cs
- SQLString.cs
- InheritanceContextChangedEventManager.cs
- UrlAuthorizationModule.cs
- Control.cs
- SeekableReadStream.cs
- serverconfig.cs
- XslTransform.cs
- StyleSelector.cs
- CompositeControl.cs
- LicenseException.cs
- HtmlTitle.cs
- ControlPropertyNameConverter.cs
- BufferBuilder.cs
- SingleStorage.cs
- EditingScope.cs
- ReplyChannel.cs
- UrlAuthorizationModule.cs
- WorkflowDesignerMessageFilter.cs
- WindowsScrollBarBits.cs
- RouteItem.cs
- ISAPIRuntime.cs
- PtsContext.cs
- Descriptor.cs
- TreeViewDesigner.cs
- Int64Converter.cs
- UIPermission.cs
- DispatcherProcessingDisabled.cs
- InvalidAsynchronousStateException.cs
- UnknownExceptionActionHelper.cs
- Int64AnimationUsingKeyFrames.cs
- ImageField.cs
- InfoCardHelper.cs
- PrincipalPermission.cs
- ObjectDataSourceDisposingEventArgs.cs
- Pkcs7Recipient.cs
- unsafenativemethodstextservices.cs
- BrowserDefinition.cs
- Event.cs
- SqlUnionizer.cs
- Menu.cs
- CompilerCollection.cs
- FileLogRecord.cs
- UpDownEvent.cs
- AppSecurityManager.cs
- XmlDataSource.cs
- IsolatedStorageException.cs
- GradientSpreadMethodValidation.cs
- EventWaitHandle.cs
- SafeCertificateStore.cs
- TabControl.cs
- ErrorStyle.cs
- TableItemPatternIdentifiers.cs
- ToolStripTemplateNode.cs
- DataGridViewCellErrorTextNeededEventArgs.cs
- SqlParameterCollection.cs
- RowUpdatingEventArgs.cs
- RemotingServices.cs
- TraceEventCache.cs
- ConsumerConnectionPoint.cs
- SelectionGlyph.cs
- AsyncOperation.cs
- UrlMapping.cs
- webproxy.cs
- Int32RectValueSerializer.cs
- PtsHelper.cs
- SchemaNotation.cs
- QueuePropertyVariants.cs
- ImageAutomationPeer.cs
- IBuiltInEvidence.cs
- WmlFormAdapter.cs
- EmptyStringExpandableObjectConverter.cs
- DataGridViewCellCancelEventArgs.cs
- NetworkAddressChange.cs
- TreeNodeBinding.cs
- SQLBytes.cs
- AbstractDataSvcMapFileLoader.cs
- WebSysDisplayNameAttribute.cs
- PackageProperties.cs
- PopupRootAutomationPeer.cs