Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / WinForms / Managed / System / WinForms / ButtonInternal / RadioButtonFlatAdapter.cs / 1 / RadioButtonFlatAdapter.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 RadioButtonFlatAdapter : RadioButtonBaseAdapter { protected const int flatCheckSize = 12; internal RadioButtonFlatAdapter(ButtonBase control) : base(control) {} internal override void PaintDown(PaintEventArgs e, CheckState state) { if (Control.Appearance == Appearance.Button) { ButtonFlatAdapter adapter = new ButtonFlatAdapter(Control); adapter.PaintDown(e, Control.Checked ? CheckState.Checked : CheckState.Unchecked); 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) { ButtonFlatAdapter adapter = new ButtonFlatAdapter(Control); adapter.PaintOver(e, Control.Checked ? CheckState.Checked : CheckState.Unchecked); 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) { ButtonFlatAdapter adapter = new ButtonFlatAdapter(Control); adapter.PaintUp(e, Control.Checked ? CheckState.Checked : CheckState.Unchecked); 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); } } 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); PaintField(e, layout, colors, checkColor, true); } #region Layout protected override ButtonBaseAdapter CreateButtonAdapter() { return new ButtonFlatAdapter(Control); } // RadioButtonPopupLayout also uses this layout for down and over 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Message.cs
- XmlNodeList.cs
- XmlDsigSep2000.cs
- HttpCookie.cs
- HitTestParameters.cs
- ContextStack.cs
- ClientApiGenerator.cs
- DesignerForm.cs
- EntityDataReader.cs
- FlowPanelDesigner.cs
- XmlIncludeAttribute.cs
- DaylightTime.cs
- HashCodeCombiner.cs
- RotateTransform.cs
- ViewGenerator.cs
- PathHelper.cs
- InputMethodStateChangeEventArgs.cs
- XmlRawWriterWrapper.cs
- GenericFlowSwitchHelper.cs
- ConsoleTraceListener.cs
- NetworkStream.cs
- RuleInfoComparer.cs
- messageonlyhwndwrapper.cs
- SqlFormatter.cs
- CompareValidator.cs
- ComponentCodeDomSerializer.cs
- SystemColors.cs
- WebConfigurationHostFileChange.cs
- FileInfo.cs
- SmiConnection.cs
- WebBrowsableAttribute.cs
- HttpValueCollection.cs
- RewritingProcessor.cs
- LicFileLicenseProvider.cs
- MetadataCacheItem.cs
- FormatException.cs
- HttpCapabilitiesSectionHandler.cs
- FlowDocumentScrollViewerAutomationPeer.cs
- KeyedHashAlgorithm.cs
- IIS7WorkerRequest.cs
- ViewManager.cs
- SystemIPInterfaceProperties.cs
- SqlProviderManifest.cs
- RunClient.cs
- StrokeSerializer.cs
- WindowsFont.cs
- PenThreadWorker.cs
- EntityDataSourceViewSchema.cs
- ColorContext.cs
- EntityCollection.cs
- SchemaInfo.cs
- CellIdBoolean.cs
- Event.cs
- uribuilder.cs
- WebPartMenu.cs
- Annotation.cs
- TextBounds.cs
- BaseServiceProvider.cs
- DynamicRenderer.cs
- TypeDescriptionProviderAttribute.cs
- CodeCastExpression.cs
- ProfessionalColors.cs
- ToolStripArrowRenderEventArgs.cs
- FileRecordSequenceHelper.cs
- FloaterParagraph.cs
- OptimalBreakSession.cs
- QuotedPrintableStream.cs
- OledbConnectionStringbuilder.cs
- PatternMatchRules.cs
- WebPartCatalogAddVerb.cs
- SqlConnectionPoolProviderInfo.cs
- PropertyCondition.cs
- DynamicDocumentPaginator.cs
- ToolStripRendererSwitcher.cs
- SamlAdvice.cs
- VirtualDirectoryMapping.cs
- ActivityCodeGenerator.cs
- XmlSchemaObject.cs
- ObjectPersistData.cs
- BlurBitmapEffect.cs
- ToolStripDropDownItem.cs
- XmlDataImplementation.cs
- XmlSchemaObjectTable.cs
- RegionIterator.cs
- TypeSource.cs
- BitmapEncoder.cs
- MetadataItemCollectionFactory.cs
- BulletChrome.cs
- DataGridViewAutoSizeModeEventArgs.cs
- EdmProperty.cs
- ProviderIncompatibleException.cs
- Compiler.cs
- OdbcErrorCollection.cs
- ProfileManager.cs
- ContentHostHelper.cs
- Guid.cs
- DllNotFoundException.cs
- EntityClientCacheKey.cs
- SqlOuterApplyReducer.cs
- TableAdapterManagerGenerator.cs