Code:
/ DotNET / DotNET / 8.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
- CodeAttachEventStatement.cs
- WindowsProgressbar.cs
- ConfigWriter.cs
- AddInServer.cs
- TableLayoutPanelResizeGlyph.cs
- XmlNodeList.cs
- TextLineBreak.cs
- MobileControlsSection.cs
- ISSmlParser.cs
- UnaryExpression.cs
- ResolvedKeyFrameEntry.cs
- ListManagerBindingsCollection.cs
- sqlinternaltransaction.cs
- HybridObjectCache.cs
- MSHTMLHost.cs
- InfoCardUIAgent.cs
- DateTimeFormatInfo.cs
- ExtensionDataReader.cs
- AdornerHitTestResult.cs
- RC2.cs
- localization.cs
- PropertyTab.cs
- SaveFileDialog.cs
- PnrpPermission.cs
- ExternalFile.cs
- PointCollectionConverter.cs
- NotifyIcon.cs
- XmlSchemaSimpleTypeUnion.cs
- CalendarItem.cs
- PathGeometry.cs
- Model3DGroup.cs
- DataContractSerializerSection.cs
- Monitor.cs
- StringFunctions.cs
- ViewBase.cs
- MultipartIdentifier.cs
- ColumnMap.cs
- ResourceKey.cs
- SchemaImporterExtensionElement.cs
- CodeIdentifier.cs
- ObjectConverter.cs
- LayoutInformation.cs
- StagingAreaInputItem.cs
- MarshalByRefObject.cs
- PropertyRef.cs
- ImageAnimator.cs
- WSFederationHttpBindingElement.cs
- CmsUtils.cs
- InfoCardConstants.cs
- SiteIdentityPermission.cs
- WebControlsSection.cs
- Task.cs
- XmlEventCache.cs
- DataObjectCopyingEventArgs.cs
- HtmlTernaryTree.cs
- HtmlGenericControl.cs
- NGCPageContentCollectionSerializerAsync.cs
- CompiledIdentityConstraint.cs
- CalendarDay.cs
- ICspAsymmetricAlgorithm.cs
- ListMarkerSourceInfo.cs
- XmlText.cs
- UniqueIdentifierService.cs
- ResourceDefaultValueAttribute.cs
- DataGridRelationshipRow.cs
- DisableDpiAwarenessAttribute.cs
- ThemeDirectoryCompiler.cs
- ElementNotEnabledException.cs
- CompoundFileDeflateTransform.cs
- FaultException.cs
- ToolStripSplitStackLayout.cs
- FixedHyperLink.cs
- WebBrowserSiteBase.cs
- TargetException.cs
- DataObjectAttribute.cs
- PreviewPageInfo.cs
- DbProviderSpecificTypePropertyAttribute.cs
- TableRowGroup.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- CodeTypeDeclaration.cs
- GridViewUpdateEventArgs.cs
- ResourcesGenerator.cs
- MessageBox.cs
- _UriTypeConverter.cs
- XmlSubtreeReader.cs
- PassportIdentity.cs
- EntityDesignerUtils.cs
- Helpers.cs
- OdbcConnectionPoolProviderInfo.cs
- SecurityTokenRequirement.cs
- AdapterUtil.cs
- OutputCacheProfile.cs
- CompositeControl.cs
- GeneratedCodeAttribute.cs
- TypeTypeConverter.cs
- ReliableSessionBindingElementImporter.cs
- IPipelineRuntime.cs
- SatelliteContractVersionAttribute.cs
- CurrentChangedEventManager.cs
- MemberCollection.cs