Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / WinForms / Managed / System / WinForms / ButtonInternal / CheckBoxFlatAdapter.cs / 1 / CheckBoxFlatAdapter.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Windows.Forms.ButtonInternal { using System; using System.Diagnostics; using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Imaging; using System.Drawing.Text; using System.Windows.Forms; internal class CheckBoxFlatAdapter : CheckBoxBaseAdapter { internal CheckBoxFlatAdapter(ButtonBase control) : base(control) {} internal override void PaintDown(PaintEventArgs e, CheckState state) { if (Control.Appearance == Appearance.Button) { ButtonAdapter.PaintDown(e, Control.CheckState); return; } ColorData colors = PaintFlatRender(e.Graphics).Calculate(); if (Control.Enabled) { PaintFlatWorker(e, colors.windowText, colors.highlight, colors.windowFrame, colors); } else { PaintFlatWorker(e, colors.buttonShadow, colors.buttonFace, colors.buttonShadow, colors); } } internal override void PaintOver(PaintEventArgs e, CheckState state) { if (Control.Appearance == Appearance.Button) { ButtonAdapter.PaintOver(e, Control.CheckState); return; } ColorData colors = PaintFlatRender(e.Graphics).Calculate(); if (Control.Enabled) { PaintFlatWorker(e, colors.windowText, colors.lowHighlight, colors.windowFrame, colors); } else { PaintFlatWorker(e, colors.buttonShadow, colors.buttonFace, colors.buttonShadow, colors); } } internal override void PaintUp(PaintEventArgs e, CheckState state) { if (Control.Appearance == Appearance.Button) { ButtonAdapter.PaintUp(e, Control.CheckState); return; } ColorData colors = PaintFlatRender(e.Graphics).Calculate(); if (Control.Enabled) { PaintFlatWorker(e, colors.windowText, colors.highlight, colors.windowFrame, colors); } else { PaintFlatWorker(e, colors.buttonShadow, colors.buttonFace, colors.buttonShadow, colors); } } private void PaintFlatWorker(PaintEventArgs e, Color checkColor, Color checkBackground, Color checkBorder, ColorData colors) { System.Drawing.Graphics g = e.Graphics; LayoutData layout = Layout(e).Layout(); PaintButtonBackground(e, Control.ClientRectangle, null); PaintImage(e, layout); DrawCheckFlat(e, layout, checkColor, colors.options.highContrast ? colors.buttonFace : checkBackground, checkBorder, colors); PaintField(e, layout, colors, checkColor, true); } #region Layout private new ButtonFlatAdapter ButtonAdapter { get { return ((ButtonFlatAdapter)base.ButtonAdapter); } } protected override ButtonBaseAdapter CreateButtonAdapter() { return new ButtonFlatAdapter(Control); } protected override LayoutOptions Layout(PaintEventArgs e) { LayoutOptions layout = CommonLayout(); layout.checkSize = flatCheckSize; layout.shadowedText = false; return layout; } #endregion } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Windows.Forms.ButtonInternal { using System; using System.Diagnostics; using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Imaging; using System.Drawing.Text; using System.Windows.Forms; internal class CheckBoxFlatAdapter : CheckBoxBaseAdapter { internal CheckBoxFlatAdapter(ButtonBase control) : base(control) {} internal override void PaintDown(PaintEventArgs e, CheckState state) { if (Control.Appearance == Appearance.Button) { ButtonAdapter.PaintDown(e, Control.CheckState); return; } ColorData colors = PaintFlatRender(e.Graphics).Calculate(); if (Control.Enabled) { PaintFlatWorker(e, colors.windowText, colors.highlight, colors.windowFrame, colors); } else { PaintFlatWorker(e, colors.buttonShadow, colors.buttonFace, colors.buttonShadow, colors); } } internal override void PaintOver(PaintEventArgs e, CheckState state) { if (Control.Appearance == Appearance.Button) { ButtonAdapter.PaintOver(e, Control.CheckState); return; } ColorData colors = PaintFlatRender(e.Graphics).Calculate(); if (Control.Enabled) { PaintFlatWorker(e, colors.windowText, colors.lowHighlight, colors.windowFrame, colors); } else { PaintFlatWorker(e, colors.buttonShadow, colors.buttonFace, colors.buttonShadow, colors); } } internal override void PaintUp(PaintEventArgs e, CheckState state) { if (Control.Appearance == Appearance.Button) { ButtonAdapter.PaintUp(e, Control.CheckState); return; } ColorData colors = PaintFlatRender(e.Graphics).Calculate(); if (Control.Enabled) { PaintFlatWorker(e, colors.windowText, colors.highlight, colors.windowFrame, colors); } else { PaintFlatWorker(e, colors.buttonShadow, colors.buttonFace, colors.buttonShadow, colors); } } private void PaintFlatWorker(PaintEventArgs e, Color checkColor, Color checkBackground, Color checkBorder, ColorData colors) { System.Drawing.Graphics g = e.Graphics; LayoutData layout = Layout(e).Layout(); PaintButtonBackground(e, Control.ClientRectangle, null); PaintImage(e, layout); DrawCheckFlat(e, layout, checkColor, colors.options.highContrast ? colors.buttonFace : checkBackground, checkBorder, colors); PaintField(e, layout, colors, checkColor, true); } #region Layout private new ButtonFlatAdapter ButtonAdapter { get { return ((ButtonFlatAdapter)base.ButtonAdapter); } } protected override ButtonBaseAdapter CreateButtonAdapter() { return new ButtonFlatAdapter(Control); } protected override LayoutOptions Layout(PaintEventArgs e) { LayoutOptions layout = CommonLayout(); layout.checkSize = flatCheckSize; layout.shadowedText = false; return layout; } #endregion } } // 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
- TableLayoutSettingsTypeConverter.cs
- PeerNearMe.cs
- EntityClientCacheEntry.cs
- DataServiceQueryProvider.cs
- ControlDesigner.cs
- ToolStripLocationCancelEventArgs.cs
- ReaderContextStackData.cs
- GroupQuery.cs
- BaseTransportHeaders.cs
- ReliableInputConnection.cs
- AttributeCollection.cs
- Metafile.cs
- GAC.cs
- PropertyTab.cs
- HttpInputStream.cs
- InternalResources.cs
- CellIdBoolean.cs
- ScrollViewerAutomationPeer.cs
- DnsPermission.cs
- SectionXmlInfo.cs
- StructuralType.cs
- ColumnResizeUndoUnit.cs
- WebControlParameterProxy.cs
- DateTimeOffsetAdapter.cs
- VectorCollection.cs
- SparseMemoryStream.cs
- ViewStateModeByIdAttribute.cs
- SqlException.cs
- CookielessHelper.cs
- SecUtil.cs
- SqlTypeConverter.cs
- DrawingImage.cs
- WeakEventManager.cs
- MaskInputRejectedEventArgs.cs
- TracingConnection.cs
- DesignConnectionCollection.cs
- DataBindingHandlerAttribute.cs
- XXXInfos.cs
- TypeUtils.cs
- EmptyEnumerable.cs
- FixedFindEngine.cs
- BitmapImage.cs
- MLangCodePageEncoding.cs
- TagMapCollection.cs
- PeerCollaboration.cs
- StringStorage.cs
- PaginationProgressEventArgs.cs
- XmlSchemaFacet.cs
- Fonts.cs
- WhiteSpaceTrimStringConverter.cs
- EventDescriptorCollection.cs
- BitConverter.cs
- SrgsSubset.cs
- UrlPath.cs
- _AutoWebProxyScriptWrapper.cs
- LinkButton.cs
- UriTemplateMatchException.cs
- PartitionerQueryOperator.cs
- FontNamesConverter.cs
- InternalConfigConfigurationFactory.cs
- TrustManagerMoreInformation.cs
- DataColumnSelectionConverter.cs
- BitmapEffectInputConnector.cs
- XmlSchemaComplexContentRestriction.cs
- Menu.cs
- RegisteredDisposeScript.cs
- SqlDesignerDataSourceView.cs
- ClosableStream.cs
- DesignTimeSiteMapProvider.cs
- AnnotationDocumentPaginator.cs
- DataGridBoolColumn.cs
- securestring.cs
- DrawingGroupDrawingContext.cs
- Tracer.cs
- ObjectQuery_EntitySqlExtensions.cs
- RadioButtonAutomationPeer.cs
- ApplicationFileCodeDomTreeGenerator.cs
- NumberSubstitution.cs
- PnrpPermission.cs
- PackWebRequestFactory.cs
- IgnoreFileBuildProvider.cs
- SocketElement.cs
- RenderDataDrawingContext.cs
- TemplateControl.cs
- OptimizedTemplateContentHelper.cs
- SQLDecimalStorage.cs
- IDispatchConstantAttribute.cs
- DataGridTablesFactory.cs
- NegotiateStream.cs
- StreamReader.cs
- ComponentDesigner.cs
- DateTimeUtil.cs
- Timeline.cs
- TextBoxView.cs
- ActivationServices.cs
- XmlSignatureProperties.cs
- TextTreeFixupNode.cs
- WebPart.cs
- MULTI_QI.cs
- FileUpload.cs